Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: pulling out only minus or plus values Post Reply Post New Topic
Author Message
Getch
Groupie
Groupie


Joined: 26 Dec 2008
Online Status: Offline
Posts: 47
Quote Getch Replybullet Topic: pulling out only minus or plus values
     Posted: 30 Jun 2010 at 8:38am
Got a bit of a problem.
 
I have a subreport that is supposed to show account activity summaries. One such summary is for investment transfer data.
 
The database has the actiivty for the sales (-) and purchases (+) in the same field/column so the sum always nets to zero.
 
I am not sure how to go about extracting/summarizing just the (-) values.
 
Is there a function or something in crystal that will get me the data I need?
Newbie reports
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 30 Jun 2010 at 10:37am

you can use my favorite variables or DBlanks running totals, they will both get you there.

variables use 3 formulas normally
1) in the group header to reset
shared numbervar aVar :=0;
"" // to hide the 0
 
2) in the details to increment
shared numbervar aVar;
if {table.field} < 0 then
  aVar := aVar + {table.field};
 
//up to you what to display, you can display the field, the total, or nothing
 
3) in the footer to display the results
shared numbervar aVar
 
where exactly these go, is up to use, I put the typical location that they occur, but you might not need to set to 0, if the formula is accumulating for the entire report.  You may not need the final display if you are displaying the running total, so it is up to you.
 
HTH
IP IP Logged
Getch
Groupie
Groupie


Joined: 26 Dec 2008
Online Status: Offline
Posts: 47
Quote Getch Replybullet Posted: 30 Jun 2010 at 11:03am
Lockwelle,
 
Thanks! I have used that once recently...It appears that might be the ticket but my total isnt balanceing correctly on my first attempt.
 
Will work with this a bit.
Newbie reports
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