?
Solved

How to Add or subtract (+ or -) from subreport value to main report vale with condition in main report.

Posted on 2005-04-05
7
Medium Priority
?
927 Views
Last Modified: 2008-01-09
Hello Bosses

I am facing a problem in crystal repor would any one like to help me plzzz..

1) I have one main Report
2) I have another sub report

I want to Add(+) subreport value (Amount) to  main report.

in the main report i want to give condition (Condtional sum)

Like if mainreport.field.value='debit' then Add value from Subreport.filed.value +mainreport.filed.value



plz any problem in Qn. plz clarify me i will tell in details


My main problem is how add or subtract from subreport value to main report value with condition in main report.

0
Comment
Question by:mivbinfotech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 10

Expert Comment

by:Spykair
ID: 13705842
You need to use shared variables to pass values between a report and its subreport.

In your subreport, create a formula that adds to a shared variable:
Whileprintingrecords;
shared numbervar Accumulate := Accumulate + {#RunningTotal};

In your main report create a formula that will display the global variable:
Whileprintingrecords;
shared numbervar Accumulate;

Hth,
Spykair.
0
 
LVL 9

Expert Comment

by:Outin
ID: 13706132
Also be sure to place the formula in the main report in a section *below* the section containing the subreport to ensure that correct values are displayed...

greetz,

Outin
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 13706494
The above comments should solve your problem.

A further explanation of sharing data between main and subreports.

http://support.businessobjects.com/library/kbase/articles/c2007600.asp

mlmcc
0
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
LVL 8

Expert Comment

by:PATKIRSCH
ID: 13708763
some clarification, please:
1) are you only passing a single value from the sub-report to the main report? or multiple values? - i.e. do you only need to add the sub-report value once on the main report, or will you need an "accumulated" running total value there also?
2) is the Debit/Credit value stipulation only in the main report formula, or also true for a conditional sum in the sub-report (p.s. am an accountant, so please feel free to futher elaborate)
0
 
LVL 2

Author Comment

by:mivbinfotech
ID: 13742715
The Format of the report is

Employe Name: XXXX           and his Opening BAlance   :2000 (This is Coming From Subreport)

Date        Entry Head      Entry Nature     Debit Amount    Credit Amount     Balance    Account  Remarks
9-Mar-05 TRAFFIC FINE     Debit               1000                                        3000(2000+1000)
15-Mar-05 TRAFFIC FINE   Credit                                    1000                  2000(3000-1000)
25-Mar-05 TRAFFIC FINE   Debit                                      500                   1500(2000-500)


So this type of Output User Wants.
1) Employee name and his Opening balances is coming fom Subreport
2)details is coming from Main report
3) to find out the Balance=from subreport opening balance + or - (Acc to debit and credit)
i m not able to find the Balances i required how to do plz help me if any one likes to. Further details i will Explain in details.
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 750 total points
ID: 13743813
In the main report header.

Formula - DeclVars
shared NumberVar Balance := 0.0;

In the subreport (subreport should be in the before the employee Name line and in that section.)

Formula - CalcBalance
shared NumberVar Balance;
Balance := {FieldInSubReportWithBalance};

In the Main detail section
Formula - MainBalance
shared NumberVar Balance;
Balance := Balance + {DebitField} - {CreditField};

May have to write it as
shared NumberVar Balance;
If isNull({DebitField} then
    Balance := Balance - {CreditField};
else
    Balance := Balance - {DebitField};

Balance

mlmcc

 
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 13803135
Glad i could help

mlmcc
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question