This content has been marked as final. Show 8 replies
The last statement is
else (WEIGHT > 5001) then
It doesn't look correct or do you copy/paste correctly?
It can be
"elseif (WEIGHT > 5001) then SHIP=15.50"
In other words, you can't attach a condition to an ELSE statement; ELSE is a catch-all for all other conditions.
Where you say
else (WEIGHT > 5001) then
that is already assumed.
The expression (1001 < WEIGHT < 2000) doesn't seem right for me. You may try something like:<br />"<br />if ( WEIGHT < 1000 ) then SHIP = 9.50<br />elseif ((1001<WEIGHT) and (WEIGHT<2000)) then SHIP=9.85<br />"<br />Henry<br />Adobe
Furthermore, I don't think the following is allowed in FormCalc:
elseif ( 4001 < WEIGHT < 4500) then SHIP=13.50
I believe you have to use the following syntax:
elseif ( 4001 < WEIGHT & WEIGHT < 4500) then SHIP=13.50
When "4001 < WEIGHT" is evaluated, it amounts to a "true" or "false" value. Writing it the first way would essentially result in comparing "true" or "false" to 4500 which likely isn't what you want to do here.
The suggested way to write the expression boils-down to evaluating two boolean ("true" or "false") values together with an "and" operator which makes more sense (where the shipping cost is 13.50 only if the weight is both larger than 4001 and smaller than 4500).
Thank you very much for your assistance. The form seems to be calculating just fine now.
I found this very helpful, thanks.
Having got this to work in my form I want to make the last figure a text line, not numerical. I.e. If the postage goes above a certain price point the customer must contact the office "POA".
I can't get it to put in anything but $0.00 at that point.
This is most likely because you're assigning the value "POA" (a string) to a numeric field. Assigning a string value to a field which expects a numerical value always results in a translated numerical value of zero (0).
There are a few solutions I could suggest but I think the easiest one would be to use what's called a "compound" pattern for the Display Pattern property of the numeric field, located on the Object palette's Field tab.
Compound Display Patterns are patterns that include multiple "inner" patterns that tell a field how to display its data in different circumstances. For example, if the field's value (data) is null (no specified value -- not even zero), the field could display "POA" (text even though it's a numeric field). Otherwise, when the field's value is specified (not null), it could display it using a normal numeric pattern such as "$z,zz9.99".
So let's say you've already specified a Display Pattern of "$z,zz9.99" for the numeric field. You would change this Display Pattern into the following compound pattern:
Notice that the original Display Pattern has been preserved but now the compound pattern includes information on what to do when the field's value is null (not specified).
Given this compound pattern, when the postage goes above a given price, you would simply assign "null" as a value to the numeric field and it would automatically display a value of "POA" (even though it wouldn't actually have a value).
To set a field to null in FormCalc, you can do this:
NumericField1 = Null
NumericField1.rawValue = null;
Thank you very much for this excellent help. It now works perfectly.