3 Replies Latest reply on Nov 30, 2012 8:48 AM by philmodjunk

# Result of calculation

### Title

Result of calculation

### Post

This statement evaluates to 332.42, i can' see why...

\$Discount_pct_cust = 61.8

\$toplinenumber1 = 267.41

\$fsc = 24.3

100-61.8= 38.2     38.2*267.41=10215.06     10215.06/100= 102.15

102.15*24.3=2482.24        2482.24/100= 24.82

102.15+24.82=126.97

Let ([

~num =  ( 100 - \$discount_pct_cust ) * ( \$toplinenumber1 / 100 )  ;

~fsc = ( ~num * \$fsc / 100 ) ;

~newRate = Round ( ~num + ~fsc ; 2 )

] ;
~newrate
)

• ###### 1. Re: Result of calculation

When I put this expression as a watch expression in my data viewer:

Let ( [ \$Discount_pct_cust = 61.8 ;
\$toplinenumber1 = 267.41 ;
\$fsc = 24.3 ;
~num =  ( 100 - \$discount_pct_cust ) * ( \$toplinenumber1 / 100 )  ;
~fsc = ( ~num * \$fsc / 100 ) ;
~newRate = Round ( ~num + ~fsc ; 2 )
] ;
~newrate
)

I get the expected answer of 126.97

Thus, I would take a look at how the three variables get values to see which one is not getting the expected value--checking closely for any data entry errors that may result in a misspelled variable name.

• ###### 2. Re: Result of calculation

I assume you are using variables in a calculation field, which do not update as you expect.  I wouldn't use variables in a calculation field, instead use fields.

• ###### 3. Re: Result of calculation

S Chamblee makes a good observation.

I had assumed this was the "calculated result" part of a Set Field or Set Variable script step.