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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot summarize formula Field. 2

Status
Not open for further replies.

birdprogrammer

Programmer
Feb 9, 2005
6
US
Hello,

I'm trying to summarize two formula fields @Full_late and @Full_On_Time but there are not an option under Running Totals function in CR. Please help. Thanks in advance.

Add'l Info: I have 5 groupings: vendor, ponumber, polinenumber, itemnumberA, itemnumberB

@Full_late = If {POP10500.DATERECD} > {POP10110.REQDATE} then 1 else 0

@Full_On_Time = If {@Qty Open*}=0 and {POP10500.DATERECD} <= {POP10110.REQDATE} then 1 else 0

{@Qty Open*} = {@Qty Ordered}-Sum ({POP10500.QTYSHPPD}, {POP10110.ITEMNMBR})

Report Preview:
ANI001
itemnumber / rct number / date rcvd / reqdate / qty order / qty ship / full ot / full late

ABC / rct1 / 11-01-04 / 11-30-04 / 165 / 85 / 1 / 0
ABC / rct2 / 12-01-04 / 11-30-04 / 165 / 80 / 0 / 1

Description of preview:
I have an order for 165 units that were fulfilled by two receipts of 80 and 85. If any of the receipts is greater than the req. date, the whole order is late. Therefore, in my group 5, it shows the order as being late. I want to sum up these two fields. What can I do?

I hope I wasn't TOO confusing.

Note: I was thinking of using a variable to do a sum but don't know how to reset the value based on a change of group in formula editor. That may help.

Thanks.
 
Here is the quick and dirty 3 formula running total method.

Formula 1 - goes in the group header where you want your reset.

whileprintingrecords;
numbervar full:=0

Formula 2 - goes in the band where the {@full_late} formula is displaying the 1 or 0

whileprintingrecords;
numbervar full;
full:=full + {@full_late}

Formula 3 - display the total

whileprintingrecords;
numbervar full

Formulas 1 and 2 get suppressed.



Mike
 
What is your goal here? If you just want to display the groups that are late, then go to report->edit selection formula->GROUP and enter:

sum({@full_late},{POP10110.ITEMNMBR}) > 0 or
(
{@Qty Ordered} - Sum ({POP10500.QTYSHPPD}, {POP10110.ITEMNMBR}) > 0 and
currentdate >= {POP10110.REQDATE}
)

If you still feel you need the summaries, you can insert a sum on {@full_late}, and for {@full_on_time} create three formulas:

//{@reset} to be placed in the group header section:
whileprintingrecords;
numbervar ontime := 0;

//{@accum} to be placed in the detail section:
whileprintingrecords;
numbervar ontime := ontime + {@full_on_time};

//{@display} to be placed in the group footer:
whileprintingrecords;
numbervar ontime;

-LB
 
Sorry, Mike. I didn't notice you had posted.

-LB
 
Thanks MBARRON and lbass for the quick response. Both your solutions worked beautifully.

Thanks a bunch!!!

MHa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top