Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Summary of formula fields Post Reply Post New Topic
Author Message
Redondo
Newbie
Newbie


Joined: 24 Oct 2013
Location: Portugal
Online Status: Offline
Posts: 9
Quote Redondo Replybullet Topic: Summary of formula fields
     Posted: 24 Oct 2013 at 6:42am
Hi,
I made a formula fields where I put a multiplication of two formulas fields:
exemple:
if {@qtedeclarees}<>0 then {@qtedeclarees}*{@custa}
else 00;

@qtedeclarees and @custa are the two formulas.

Now I wanted to make a sum formula in this field, but when i insert Summary the formula fields not appear on the "Choose a field to summarize"

someone can help me please?
Luis
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 24 Oct 2013 at 6:52am
its probably because one of the formulas is also a summary.
one way to is to create a sub report and use shared variable.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 24 Oct 2013 at 10:38am
since the formula is not performed all the time, it cannot be summarized. CR uses several passes through the data, and summarization is before the report is rendered. The formula is evaluated at the time the report is rendered...so it is too late to be summarized.

You can use Running Totals or Variables to keep track of the sum as a work around.

HTH
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 24 Oct 2013 at 10:13pm
Hi
 
Create the following formulas and place them in your report as suggested :
 
Whileprintingrecords;  // Place this formula where you are displaying the
Numbervar x;            // multiplying valeus
x:=x+{@qtedeclarees}*{@custa};
 
 
Whileprintingrecords;  // Place this where you want to see the summary.
Numbervar x;
 
 
Thanks,
Sastry
IP IP Logged
Redondo
Newbie
Newbie


Joined: 24 Oct 2013
Location: Portugal
Online Status: Offline
Posts: 9
Quote Redondo Replybullet Posted: 25 Oct 2013 at 3:56am
Hi, thanks for the help. but... how do I use Shared variables?

One more times thanks
Luis
IP IP Logged
Redondo
Newbie
Newbie


Joined: 24 Oct 2013
Location: Portugal
Online Status: Offline
Posts: 9
Quote Redondo Replybullet Posted: 25 Oct 2013 at 5:00am
Hi, thanks for the reply.
works great

Luis
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 Oct 2013 at 6:17am
What Sastry has provided is a basic shared variable.
Usually shared variables come in groups of 3 formulas: reset, increment, and display. Sastry has given the increment and the display.

reset is pretty basic:
Numbervar x := 0;
"" //will hide zero on the report

for reference,
reset is typically in a group header
increment is in details
and display is in group footer

HTH

Edited by lockwelle - 25 Oct 2013 at 6:56am
IP IP Logged
Redondo
Newbie
Newbie


Joined: 24 Oct 2013
Location: Portugal
Online Status: Offline
Posts: 9
Quote Redondo Replybullet Posted: 27 Oct 2013 at 11:16pm
thank you, was a great help as that of Sastry

Luis
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