on 04-21-2013 12:45 PM
Hi All,
I have a sub report in that i created a formula like this.
local numberVar vararesult;
local numbervar ads ;
local numbervar atrans;
if ({Command.tarAds})>=({Command.actAds}) and ({Command.tarTrans})>=({Command.actTrans})
then vararesult := {Command.tarSale}-{Command.actSale}
else (
if {Command.tarAds}>{Command.actAds} then
ads := {Command.tarAds}
else
ads := {Command.actAds};
if {Command.tarTrans}>{Command.actTrans} then
atrans :={Command.tarTrans}
else
atrans :={Command.actTrans};
vararesult := (ads *atrans)-{Command.actSale} )
Now in the main report i need to show sum of this formula.I tried using shared variable but getting errors,as my formula already contains some local variables.
Ex:
12
3
4
5
sum: 24
Please suggest
Hi Francis,
Open the formula in the Subreport and modify the code to this:
local numberVar vararesult;
local numbervar ads ;
local numbervar atrans;
shared numbervar tot;
if ({Command.tarAds})>=({Command.actAds}) and ({Command.tarTrans})>=({Command.actTrans})
then vararesult := {Command.tarSale}-{Command.actSale}
else (
if {Command.tarAds}>{Command.actAds} then
ads := {Command.tarAds}
else
ads := {Command.actAds};
if {Command.tarTrans}>{Command.actTrans} then
atrans :={Command.tarTrans}
else
atrans :={Command.actTrans};
vararesult := (ads *atrans)-{Command.actSale} );
tot := tot + vararesult;
vararesult;
Go back to the Main report and create a formula to display the result.
shared numbervar tot;
NOTE: The display formula needs to be placed on the Main Report in a section below the subreport, otherwise you won't see the results. For e.g. if the Subreport is in Report Header a, then the display formula needs to go in Report Header b or any other section below Report Header a.
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhilash,
I did what you said but i am getting result like this.
I am getting result like running total.
PFA in attachment 1512,3024 are shared vars totals.
Ex:
Brand Category:A-a1 (Group)
1
2
3
Sum:6
Brand Category:A-a2 (Group)
1
2
3
sum:12 Here it should display 6
Brand Category:B-b1 (Group)
4
5
6
sum:27 Here it should display 15
Brand Category:C-c1 (Group)
2
1
8
sum:38 Here it should display 11
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.