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

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.

LVL 2
mivbinfotechAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mlmccConnect With a Mentor Commented:
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
 
SpykairCommented:
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
 
OutinCommented:
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
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
mlmccCommented:
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
 
PATKIRSCHCommented:
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
 
mivbinfotechAuthor Commented:
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
 
mlmccCommented:
Glad i could help

mlmcc
0
All Courses

From novice to tech pro — start learning today.