cancel
Showing results for 
Search instead for 
Did you mean: 

Please help explain this formulae

former_member584790
Participant
0 Kudos

if {SOP10100.SOPTYPE} in [3, 4] then

{SOP10200.QUANTITY}

else

0

Does "in(3,4) mean that if the value of SOP10100.SOPTYPE is 3 or 4 ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

in crystal syntax,


 if {field} in [3,4] then 
{otherfield} else 0 

Would mean that if the value of is exactly 3 or 4 then the result is and in all other cases it is 0.

i believe that you must use these [] types of brackets, not () or {}. Also, if it is a string field, not a number, your values would have to be entered like this ['3','4'].

Answers (1)

Answers (1)

Former Member
0 Kudos

Yes the IN function means if the tested value is one of the possible values

for example


if 1 in [1,2] then
"in"
else
"not in"

will result in the word in being displayed because the tested value 1 is one of the possible values 1 OR 2

The square brackets [ ] surround the list of possible values

You can also do this


if "abc" in "abcdefgh" then
"in string"
else
"not in string"

Look in the help index for IN

Best regards

Patrick