3 Replies Latest reply on Dec 31, 2012 11:10 AM by philmodjunk

# Evaluate

Evaluate

### Post

I can't see why this is not evaluating correctly: It evaluates to... \$weightmultiplier2 = 2637 or the 1st value...

\$weight2 = 2000

\$fivehunderdlbs = 2637

\$onethousand = 2191

\$twothousand = 1687

Set Variable [ \$Weightmultiplier2; Value:

Let ( ~w = \$weight2 ;

Case ( ~w < "501"; \$fivehundredlbs ; ~w < "1001" ; \$onethousandlbs ; ~w < "2001" ; \$twothousandlbs ; ~w < "5001" ; \$fivethousandlbs ; ~w < "10001" ; \$tenthousandlbs )) ]

• ###### 1. Re: Evaluate

You set your variables to number and you are checking Text with the ""  in your case statement.

\$ = local varible and \$\$ = Global variable.  You didn't state where you were setting these variables, so the wrong amount could be passed to your let  / case statement.

If all variables are local then use the following.

Let(~W= \$weight2;
Case(~W < 501 ; \$fivehundredlbs;
~W<1001; \$onethousandlbs;
~W<2001; \$twothousandlbs;
~W<5001; \$fivethousandlbs;
~w<10001;\$tenthousandlbs)
)

• ###### 2. Re: Evaluate

As well as S Chamblee's comment:

I don't know if you copied and pasted the calculations, but the variable names don't match.  For example: \$fivehunderdlbs and \$fivehundredlbs; and you don't say where you set the variables \$fivethousandlbs and \$tenthousandlbs.

(Also, note that S Chamblee's layout of the Case statement makes it much easier to read and de-bug.)

• ###### 3. Re: Evaluate

It's also possible to forgo the calculation and use a relationship with this value to look up values from a table. This can often make managing future changes to the values much easier--a data entry task instead of a database design change task.