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

Summarising a Formula Field that cannot be summarised

Status
Not open for further replies.

bernie321

Programmer
Jan 7, 2004
477
GB
Hi

We have a formula field that performs this calculation:

IF {Orders.Type} = 0 THEN
Sum ({TT.Value}, {Orders.Number}) - Sum ({TT. ValueBilled}, {Orders.Number}) ) * {@UserRate}
ELSE
0

The calculation is performed grouped by Customer then Order.

I cannot summarise this field and cannot use a running total.

{@UserRate} is just {user.rate} / 100 but the user.rate field is linked to the Order.

Any help would be much appreciated

Thanks B
 
You would need to use variables. I guess you need this at the customer and grand total levels? Then create four formulas:

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

//{@accum} to be placed in the order group header or footer:
whileprintingrecords;
numbervar cust := cust + {@yourformula};
numbervar gttot := grtot + {@yourformula};

//{@displcust} to be placed in the customer group footer:
whileprintingrecords;
numbervar cust;

//{@displgttot} to be placed in the report footer:
whileprintingrecords;
numbervar grtot;

-LB

 
Hi

Thanks for your post:

I have added @Accum and @Displgttot to my report (as I only require grand total)

Crystal says that there is an error with my formula on the row below I receive the error 'a number is required' on the section 'grtot + {@Final}'.

numbervar grtot := grtot + {@Final};

Thanks

B
 
Is {@Final} a currency? What datatype appears if you move your mouse over the formula on the report? If it is a currency, change the variable to:

currencyvar grtot

I noticed I had a typo in my formula where I used gttot in one place and grtot in the other. You fixed that, correct?

-LB
 
Thank you, yes it was a currency.

Yes I fixed the typo.

Many thanks for your help
B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top