Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Subtract (sum fields) which are on report footer Post Reply Post New Topic
Author Message
mohsinhasan87
Newbie
Newbie


Joined: 22 Jul 2012
Location: India
Online Status: Offline
Posts: 7
Quote mohsinhasan87 Replybullet Topic: Subtract (sum fields) which are on report footer
     Posted: 01 Aug 2012 at 1:35am
Hi,
I have one group on my report which has two fields Gross and Net.On details I have their details and on the group footer I have their summary as sum of both gross and net and on the report footer again sum summary of gross and net.

Eg:
Details :
Name Gross Net
ABC 100    200
XYZ 200    300
----------------
Group Footer:
     300    500   
----------------
Name Gross Net
DEF 200    300
----------------
Group Footer :
     200    300
-----------------
Report Footer :
     500     800

What I want to achieve is subtract report footer field
Eg: 500-800 = -300.

How can I achieve this? I tried this formula
sum({field1}) - sum(filed2) but it says result should be boolean then I did this
sum({field1}) - sum(filed2) > 0. No errors but also no data.
Please help .
Thank you





Edited by mohsinhasan87 - 01 Aug 2012 at 1:55am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Aug 2012 at 3:55am

use the field explorer formula fields to create formulas, not the select expert

IP IP Logged
mohsinhasan87
Newbie
Newbie


Joined: 22 Jul 2012
Location: India
Online Status: Offline
Posts: 7
Quote mohsinhasan87 Replybullet Posted: 01 Aug 2012 at 5:20am
Hi,
Thanks for the response but I have used the formula editor window to create formula not the select expert and moreover please tell me the formula to get the subtracted data.Is my formula correct or do I need to make any changes?
Thank you
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Aug 2012 at 5:35am
sum(table.field1)-sum(table.field2)
should work.
usually when it is asking for a boolean result people have incorrectly placed the formual in the select expert (which wants a boolean result).
IP IP Logged
mohsinhasan87
Newbie
Newbie


Joined: 22 Jul 2012
Location: India
Online Status: Offline
Posts: 7
Quote mohsinhasan87 Replybullet Posted: 01 Aug 2012 at 5:45am
okay, I will update the thread if it worked.

Thanks for responding.
IP IP Logged
mohsinhasan87
Newbie
Newbie


Joined: 22 Jul 2012
Location: India
Online Status: Offline
Posts: 7
Quote mohsinhasan87 Replybullet Posted: 01 Aug 2012 at 7:36pm
okay It worked. I was using expert all the time after creating new formula, though I am not an expert. I used editor and it worked. Thank you so much.I have 2-3 queries as well, so shall I create a new thread or ask in this one?
IP IP Logged
mohsinhasan87
Newbie
Newbie


Joined: 22 Jul 2012
Location: India
Online Status: Offline
Posts: 7
Quote mohsinhasan87 Replybullet Posted: 01 Aug 2012 at 10:57pm
Another issue is --

I have one formula which shows the percentage according to gross we just calculated above. I used this formula to show percentage of gross.
shared numbervar rtTotal;
local numbervar thisTotal;
thisTotal :={dt_VU_GETMSG_SERVICE.TOTALAMOUNT_} % Sum ({dt_VU_GETMSG_SERVICE.TOTALAMOUNT_}, {dt_VU_GETMSG_SERVICE.FSERVICE_NETWORK});
rtTotal :=rtTotal+thisTotal;

and created a new formula for displaying the summary like this
shared numbervar rtTotal;
rtTotal;

but on my report it keep adding the record in the next field.
For Eg:

Details:
Name Percentage
ABC    20%
XYZ    29% ---> Original Value 9%
DFG    31% ---> Original Value 2%

At the end on group footer it shows 31%(last value).

I want to sum all the percentage field on details and show them on group footer.How can I achieve this?

Thank you
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum