Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running total question 1

Status
Not open for further replies.

mbDutch

MIS
Nov 13, 2007
39
US
newbie question

I have a delivery report that contains 4 groups:
group1: Customer (header supressed)
group 2: Sequence extension (supressed)
group 3: Sequence number (supressed)
group 4: Order line (header supressed)

Now I have a formula in Groupfooter 4 which is:
LineOnTime: IF {table.Date-shipped} <= {table.Date-docked} then 1 else 0

according to the formula 2 of the order lines are "1" .. so I created a running total that Sums LineOfItem (eval in group4 reset on group 1) however it's returning a total of 4 and not 2.

What am I doing wrong here?
 
If you do a sum of that formula it will treat it as though its a detail line. YOu will probably find you have two details, in each of the groups.

Change to a running total of that formula and evaluate on change of group 4. The RT should then only return 2.

Ian
 
Hmm still 4. If it helps any - I am converting this report from Progress report builder to Crystal. In report builder I was able create a running total max on that formula and then another running sum on the running max but Crystal wont allow for creation of a running total based on another running total.
 
To add a little more detail -
There are several lines for group 4. I only want to count the LineOnTime formula once per group 4 and then Sum it. As I stated above in Report Builder I had a running total that does a Max on the formula and resets on group 4 and then another running total that Sums the max running total with an evaluation on group 4 and a reset on group 1.
 
Crystal will not allow you to do that with RTs. You will have to create formulae using variables which replicate what you describe.

Ian
 
Thanks Ian. I'll play around with variables as my experience with variables is virtually non existant.
 
Please show some sample data at the detail level (after you have grouped) and then show how you want it to appear in your final report. It is unclear what you mean by once per Group 4--does this mean only once per instance of Group #4, or only once on the first instance of Group #4?

-LB
 
Alrighty - For example the datail line will show:

order# Line ext Company DueDate ActualDate LineOnTime
AB-1234 001 aaa XYZ 09-14-07 09-06-07 1
AB-1234 001 bbb XYZ 09-14-07 09-11-07 1
AB-1234 001 ccc XYZ 09-14-07 09-18-07 0

LineOnItem is the formula: IF {table.ActualDate} <= {table.DueDate} then 1 else 0.

I only want to count {@LineOnTime} once per Line (group 4) thus I want to do a Max({LineonTime}).
Then I want to Sum the Max({LineonTime})and place the result in the group footer of group 1.
 
You could change your lineontime formula to


whileprintingrecords;

global booleanvar lineontime
IF {table.ActualDate} <= {table.DueDate} then lineontime:=true

//This will find any record where line is ontime and switch on, can not switch off if encounters line not on time.

in Group4 header
@reset

whileprintingrecords;

global booleanvar lineontime:=false
// This resets lineontime boolean for each line.


In Group4 footer

@linevar count

whileprintingrecords;

global booleanvar lineontime;
global numbervar linecount;

If lineontime = true then linecount:= linecount+1

In report footer

@linecount total

whileprintingrecords;

global numbervar linecount;

Hope I have understood what you want

Ian
 
Create three formulas:

//{@reset} to be placed in GH1:
whileprintingrecords;
numbervar summax;
if not inrepeatedgroupheader then
summax := 0;

//{@accum} to be placed in GH#4:
whileprintingrecords;
numbervar summax;
if maximum({@LIneOnItme},{table.OrderLine}) = 1 then
summax := summax + 1;

//{@displ} to be placed in GF#1:
whileprintingrecords;
numbervar summax;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top