Creating a conditional statement

08-22-2017 02:57 PM
New Contributor II

Hello, I'm having trouble with how to write a 'relevant' conditional statement based the answers to previous fields. Here is some background information.

I have 5 fields:

  • NEEDED, type - select_one, choices - yes or no 
  • CORNER_TYPE, type - select_one, choices - CD, IT, D, ID, CS, I
  • RAMP1
  • RAMP2
  • RAMP3

My conditional statement is:

When the field Needed is Yes, ramp fields are enabled/disabled based on the Corner_Type:

  • If Corner_Type is CD (Continuous Double) or ID (Island Double), Ramp1 and Ramp2 fields are enabled.
  • If Corner_Type is D (Diagonal) then only Ramp1 is enabled.
  • If Corner_Type is IT (Island Triple) or I (Incomplete) then all ramps are enabled.
  • If Corner_Type is CS (Continuous Single) then all ramps are enabled 

Is it possible to write out all of the above scenarios in just one function?

Thank you in advance.


Tags (1)
0 Kudos
3 Replies
New Contributor III

Can you confirm that bullet point three and four are both meant to say 'enabled'?

If so, I'd try this and see if it works as you need.

RAMP2${NEEDED}='yes' and ${CORNER_TYPE}!='D'


${NEEDED}='yes' and ${CORNER_TYPE}!='D' and ${CORNER_TYPE}!='CD'

If bullet three or four is meant to disable all RAMPs, just add another ${CORNER_TYPE}!=

0 Kudos
Esri Esteemed Contributor

Small modification - RAMP3 also needs 

and ${CORNER_TYPE}!= 'ID'

RAMP3 could also be expressed by the valid values (as there are 3 valid values and 3 invalid values); this is the pattern I would use if the number of invalid values is larger than the number of valid values:

${NEEDED}='yes' and (${CORNER_TYPE}='IT' or ${CORNER_TYPE}='CS' or ${CORNER_TYPE}='I')

New Contributor III

James's reply is one way to do it. Here is another approach. Both should work for you.

0 Kudos