1 Reply Latest reply on Feb 20, 2014 6:08 AM by Magus069

# If then statement calculation

I am having difficulty getting a statement to work.  Basically I want to have field 1 take "x" value and then return an "x" value in Field 2. 3 options for field 1 that returns the value of that option into field 2.

This is what I have that returns errors:

If (Field 1 eq "A") then (Field 2 eq "10")

elseif

If (Field 1 eq "B") then (Field 2 eq "8")

elseif

If (Field 1 eq "C") then (Field 2 eq "6")

endif

Can someone help me with the correct syntax to perform this operation? I am sure I have something wrong somewhere. Or maybe I am using the wrong type of statements for this operation.

Thank you!

Tom

• ###### 1. Re: If then statement calculation

1. You can't have a 'elseif' followed by an 'If' because your 'elseif' is already an 'If' statement

2.FormCalc 'if' statement operators are used as letters, so to have 'equal to' is 'eq', to have 'lower than' is 'lt', to have 'greater than' is 'gt', to have 'lower or equal to' is 'le'... etc...

To assign a value to a field or variable you must use the '=' sign

If (Field1 eq "A") then

Field2 = "10"

elseif (Field1 eq "B") then

Field2 = "8"

elseif (Field1 eq "C") then

Field2 = "6"

endif