Conditional statement from select_one value

820
2
Jump to solution
04-09-2018 11:36 AM
by Anonymous User
Not applicable

I have a select_one question with 6 values for bolt sizes, I want to populate a note after that question with the correct torque value from a table based on the bolt size. I assume that I need an if statement in the calculation filed but I can't figure out the formatting of the statement. 

Bolt SizeTorque

.5

17
.62550
.7575
.87583
1125
1.125212
0 Kudos
1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi Andrew,

There are a few of things at issue.  The first is that the selected() function requires 2 parameters - the question to check and teh value to check (it doesn't need the = sign in the formula).  The second is that, based on your parenthesis, the if statement had only 1 parameter, not 3.  Finally, the value you are checking is specified as '.5'; you should check for '0.5' (these aren't the same when treating the values as text, which is how select_one questions are stored).

if(selected(${BoltSize}, '0.5'),'17', 'other') 

should get you started - in the place of 'other', you would proceed to have a nested series of if() statements to select the proper value.

It might be a little simpler to treat this as a data table and use pulldata() to look up the values instead.

View solution in original post

0 Kudos
2 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Andrew,

There are a few of things at issue.  The first is that the selected() function requires 2 parameters - the question to check and teh value to check (it doesn't need the = sign in the formula).  The second is that, based on your parenthesis, the if statement had only 1 parameter, not 3.  Finally, the value you are checking is specified as '.5'; you should check for '0.5' (these aren't the same when treating the values as text, which is how select_one questions are stored).

if(selected(${BoltSize}, '0.5'),'17', 'other') 

should get you started - in the place of 'other', you would proceed to have a nested series of if() statements to select the proper value.

It might be a little simpler to treat this as a data table and use pulldata() to look up the values instead.

0 Kudos
by Anonymous User
Not applicable

Thanks James, using pulldata() was a better solution for this. 

0 Kudos