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

formulas not multiplying right 1

Status
Not open for further replies.

tonyvee1973

IS-IT--Management
Oct 22, 2009
156
GB
Hi All

I have 2 x formulas i am trying to multiply and looks like below:
{@f_qty} * {@difference}

One example: the figure in {@f_qty} is 24.00 and the figure in {@difference} is 0.43.
When i do the sums on a calculator the result should be 10.32 but in my report it shows 10.20.

I've looked at rounding and thats all ok as the decimals are 1.00 and the roundings are 0.01 - Both formulas are based on number fields so i cant see why this is happening, any ideas?
Attachment of sshot showing what i mean

Thanks
 
You need to show the content of the formulas (and of any formulas nested within them) and also explain what the total consists of.

Also identify your group structure (what you are grouping on) and in what report section these formulas are placed.

-LB
 
Hiya LB,

Content of {@f_qty} formula:
if {SL_TRANSACTIONS.ST_TRANTYPE} = 'CRN'
then {ORD_DETAIL.OD_QTYINVD}*-1
else {ORD_DETAIL.OD_QTYINVD}

Content of {@difference} formula:
{@soldminus5%}-{@Eachprice}

Copy of my formula which should simply do the math:
{@f_qty}*{@difference}

I would have thought this should have worked?

Nested formulas from above:

Contents of {@soldminus5%}:
{?Base Price}-{@Percentoff}

Contents of {@eachprice}:
if {@f_qty} = 0 then 0 else
{@f_nett}/{@f_qty}

Any help really would be appreciated, i'm going around in circles here. Maybe there is another way to Multiply {@f_qty}*{@difference} than what i am doing?



 
You didn't show the content of all nested formulas and you didn't respond to all of my questions.

-LB
 
TonyVee1973,

The issue is the report is using the "raw" values of the field, not the value visible to you.

Doing some quick math, we can extrapolate that:
[tt](24 * x) = 10.2
x = 0.425[/tt]
0.425 to 2 decimals would of course appear as 0.43

To work around this, incorporate the Round() function into your formulas -- this will use a rounded value in the calculation vs the field value.

For Example:
{@Difference}
Code:
[blue]Round[/blue]({@soldminus5%}-{@Eachprice},2)
(unable to log into Crystal to test, but I am near-certain this is the syntax)

Cheers! I hope this helps!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Thanks Mike, this works a charm!
You're an absolute legend and saved me more grey hair (Crystal report course for me in the new year!) :)
Have a great Christmas!
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top