Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula Filtering Post Reply Post New Topic
Author Message
ltt19
Newbie
Newbie


Joined: 11 Jun 2009
Online Status: Offline
Posts: 2
Quote ltt19 Replybullet Topic: Formula Filtering
     Posted: 11 Jun 2009 at 7:51pm
Hi,

I need to, based on a condition, sum all the values of the field in the report.

I've created the fallowing formula:

WhileReadingRecords;
NumberVar somavalor;
If {movimentos.custoreceita} = 'Variavel'
Then somavalor := somavalor + {movimentos.valorpago};
somavalor;


However, it displays the sum record by record, for instance, the row A displays A, row B displays A + B, and so on. The total amount is only displayed on the last row of the last page.

How can I fix this? I Want the same value on all rows, being the value the sum of everything.

I'm new to CR, and I was unable to find anything similar on the internet.

Any help would be very appreciated.
Thanks in advance.

 



IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 12 Jun 2009 at 7:01am
if you don't want to see the sum as it is calculated then change the last somavalor to "", this will hide the sum.
 
Depends on where you want to see the total.  At the end, just write another formula:
Numbervar somavalor
 
and place this where you want it.  If it to be anywhere except the bottom of the report, you will need to create subreport to calc this number first.
 
Since Crystal reads the data one line at a time, with this type of formula, you need to read all the data first, there is no Aggregate that will work.
 
HTH
IP IP Logged
ltt19
Newbie
Newbie


Joined: 11 Jun 2009
Online Status: Offline
Posts: 2
Quote ltt19 Replybullet Posted: 12 Jun 2009 at 7:10pm
Thanks,

I've figured out that putting the field on the Report Footer Section, it works just like I want.

Best Regards,

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