Link to home
Start Free TrialLog in
Avatar of jessebrannen
jessebrannenFlag for United States of America

asked on

Crystal cannot sum formula

IF {Z_MEV_MONTH.ComponentItemNumber} = "120001" Then
((({Z_MEV_MONTH.NewProduction}* 0.47) - ({Z_MEV_MONTH.DeltINV}* -1)) * 0.26)
Else If  {Z_MEV_MONTH.ComponentItemNumber} = "81009" Then
((((({Z_MEV_MONTH.DeltINV}/({@Total ASA}*0.3) * 0.6411) * {Z_MEV_MONTH.NewProduction})*-1) - ({Z_MEV_MONTH.DeltINV}* -1)) * .311)
Else If {Z_MEV_MONTH.ComponentItemNumber} = "81010" Then
((((({Z_MEV_MONTH.DeltINV}/({@Total ASA}*0.3) * 0.6411) * {Z_MEV_MONTH.NewProduction})*-1) - ({Z_MEV_MONTH.DeltINV}* -1)) * .311)

Will not sum
Avatar of wellhole
wellhole

Make sure that the values in your maths are all numeric. Crystal may have trouble if any value it reads is null. Either goto the file menu and set all database nulls to default values, or catch these suckers and handle them.
Avatar of peter57r
I suspect the problem is this formula field
{@Total ASA}
Judging from the name it looks like this might be doing a calculation across multiple records.
If so then it probably can't be used in a formula which is summed.

You  would have to use variables and build your own sum as you go.
Avatar of jessebrannen

ASKER

having trouble with variables

Whileprintingrecords;

Global CurrencyVar Tot;

Tot = Tot + IF {Z_MEV_MONTH.ComponentItemNumber} = "120001" Then
((({Z_MEV_MONTH.NewProduction}* 0.47) - ({Z_MEV_MONTH.DeltINV}* -1)) * 0.26)
Else If  {Z_MEV_MONTH.ComponentItemNumber} = "81009" Then
((((({Z_MEV_MONTH.DeltINV}/({@Total ASA}*0.3) * 0.6411) * {Z_MEV_MONTH.NewProduction})*-1) - ({Z_MEV_MONTH.DeltINV}* -1)) * .311)
Else If {Z_MEV_MONTH.ComponentItemNumber} = "81010" Then
((((({Z_MEV_MONTH.DeltINV}/({@Total ASA}*0.3) * 0.6411) * {Z_MEV_MONTH.NewProduction})*-1) - ({Z_MEV_MONTH.DeltINV}* -1)) * .311)

just returns True or False???
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you!!!! Syntax, sytax, syntax.