Select to view content in your preferred language

Multiple if/then statements in a calculation to populate a field, syntax issue

124
2
Jump to solution
2 weeks ago
BryceHancock
Occasional Contributor

I am trying to use multiple if statements in the calculate field of an xls form to populate a field. The1st if statement executes correctly but the 2nd statement in bold does not execute when the CAT_4 is selected in the RMZ_CLASS field. I know it has to do with the way the statement is structured but I cannot figure it out. 

if(selected(${RMZ_CLASS}, 'CAT_1') or selected(${RMZ_CLASS}, 'CAT_2') or selected(${RMZ_CLASS}, 'CAT_3'), ('100 Feet'), '0 Feet' or if(selected(${RMZ_CLASS},'CAT_4'),('50 Feet'),'0 Feet'))

When I choose CAT_1, 2, or 3 in the list '100 Feet' is returned in the field, but if I choose CAT_4, '0 Feet' is returned, when it should return '50 Feet'.

Anyone have ideas where I am going wrong?

 

Thanks!

0 Kudos
1 Solution

Accepted Solutions
ChristopherCounsell
MVP Regular Contributor

It's the way you've put the if statement as a condition. Might be better to put it as a nested if statement in the original 'else'. If(logic,value,else)

if(selected(${RMZ_CLASS}, 'CAT_1') or selected(${RMZ_CLASS}, 'CAT_2') or selected(${RMZ_CLASS}, 'CAT_3'), '100 Feet',
if(selected(${RMZ_CLASS}, 'CAT_4'), '50 Feet', '0 Feet'))

View solution in original post

2 Replies
ChristopherCounsell
MVP Regular Contributor

It's the way you've put the if statement as a condition. Might be better to put it as a nested if statement in the original 'else'. If(logic,value,else)

if(selected(${RMZ_CLASS}, 'CAT_1') or selected(${RMZ_CLASS}, 'CAT_2') or selected(${RMZ_CLASS}, 'CAT_3'), '100 Feet',
if(selected(${RMZ_CLASS}, 'CAT_4'), '50 Feet', '0 Feet'))

BryceHancock
Occasional Contributor

Thank you!

0 Kudos