Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: It should be so simple... Post Reply Post New Topic
Author Message
tburfield
Newbie
Newbie


Joined: 08 Jan 2009
Online Status: Offline
Posts: 4
Quote tburfield Replybullet Topic: It should be so simple...
     Posted: 08 Jan 2009 at 5:52am
Hi,

I have a report that I'm struggling to do something with that seems so simple.

Basically, I have a bunch of estimates, some of which will have further revisions, others will just have a single version.

So, an estimate could comprise of just 0001/001 or it could comprise of estimate 0002/001 and 0002/002.

I have a formula field that truncates the 001 or 002 off of the end of the field, and then have a running total that counts each of the estimate numbers that are the same, so that it looks as below.

0001   1 *
0002   1 *
0002   2
0003   1 *
0004   1 *
0005   1 *
0005   2
0005   3
0006   1 *

I need to only show entries where the running total is 1 (ie the first version of the estimate). These are marked with an *.

Unfortunately I'm unable to supress the section, as I'm already supressing the relevant section based on some other conditions.

I used to use the Progress 4GL, and within that I could simply say:

if running_total > 1 then next.

Is there an equivalent command in Crystal that I could use?

Many thanks,

Tony



Edited by tburfield - 08 Jan 2009 at 5:54am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Jan 2009 at 6:21am
If I understand correctly, you only want the entries with astericks to appear on the report.  If so, it would seem that in your formula to trim the 001 etc off, you could set a flag say bVisible to true or false, and then in your suppression formula you could reference the flag in an 'or' statement that would supress the non asterick records.  I would use a shared variable to access the flag.
 
Sometimes I have found that this does not work if all of the formulae are on the same line, so I will add a line to the section, move it above what I want suppress, put my formula in it, and suppress it.
 
Hope this helps
IP IP Logged
tburfield
Newbie
Newbie


Joined: 08 Jan 2009
Online Status: Offline
Posts: 4
Quote tburfield Replybullet Posted: 08 Jan 2009 at 6:32am
How would I set the value of bVisible? I would need to know whether it was the first iteration for that estimate, and am unable to refer to the running total field in the formula.


IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Jan 2009 at 6:46am
OK, shared variables are just the most useful thing in Crystal, I use them all the time.
 
In the formula to strip off the 001/002 (I am assuming that this states if it is the first estimate or one of the 'other') at the top add a line:
Shared BooleanVar bVisible := false;   //since it is always false except
 
Where you are stripping off the ending, check if it is 001, then set the flag, something like:
 
if mid({field}, instr({field}, "/"))="/001" then
    bVisible := true;
 
Then in your suppression formula add at the top:
Shared BooleanVar bVisible;
 
and add onto the end formula 'or bVisible = false' or whatever logic is needed.
 
But something like that.  This can of course to be modified to look at a value, if that is needed, I would 'create' my own running total in formulae and reference the amount in the record vs my variable.  Once you get used to shared variable, there is so much that you can do in a report.
 
Hope this helps
IP IP Logged
tburfield
Newbie
Newbie


Joined: 08 Jan 2009
Online Status: Offline
Posts: 4
Quote tburfield Replybullet Posted: 08 Jan 2009 at 6:55am
Unfortunately, the first estimate version will not always be 001

If they delete the original version for instance, then the first version left on the system will be 002.

This is why I'm using the running total to physically count the already sorted estimates, and then to identify the version that it comes across first, I can simply look for the version that has a running total value of 1.

The formula to strip off the 001, only does that. Its then passed back into the report where it is counted by the running total.

Quite happy using shared variables, and have done so on a number of different reports, but this has got me licked!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Jan 2009 at 7:01am
OK, next option, would be to ask if there is a group on the 'other' number the 0001.  If there is, I would put my logic when the group changes (assuming that the estimate number is attached so that the estimates are in order).  Every time the group changes you could put the estimate in a variable and compare that later or you set the visible to true and at the end of the detail section being displayed set it to false so that all subsequent records are suppressed.  Again you might need to add a 'hidden' line in the section to change the variable so that all 'appears' as you want.
 
Hope this helps
IP IP Logged
tburfield
Newbie
Newbie


Joined: 08 Jan 2009
Online Status: Offline
Posts: 4
Quote tburfield Replybullet Posted: 08 Jan 2009 at 7:14am
No groups at all being used. The report just needs to work on estimates in estimate number order, and so is just sorted on that basis.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Jan 2009 at 7:20am
ok, a) could put a group, but not needed.
b) shared variable of 'current' estimate number, when it changes...
c) when you reset the running total, use that condition to change the variable.
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