<If>with taxonomy / taxonomy field values

Oh, interesting! I just tested your syntax again and based on what I’m seeing, when you use your syntax for the is comparison, the If statement always ends up being true no matter what.

<Set name=david_rocks>definitely</Set>

<If check="{Get david_rocks}" is value="definitely">Y1 
  <Else />N1 
</If>

<If check="{Get david_rocks}" is value="maybe">Y2 
  <Else />N2 
</If>

<If check="{Get david_rocks}" is="definitely">Y3 
  <Else />N3 
</If>

<If check="{Get david_rocks}" is="maybe">Y4 
  <Else />N4 
</If>

Output: Y1 N2 Y3 Y4

Y1 and N2 are what you’d expect when using the documented syntax, but when you use yours and Eliot’s is="some_value" syntax, the If statement always ends up being true. Maybe Eliot made the more_than and less_than_or_equal comparisons work this way, but not the is comparison? That would be weird, but he’s the only one who could answer that. In any case, this seems to have confirmed that it’s safer to go with what’s in the documentation, which is is value="some_value".

Edit: I just checked out Eliot’s comment in that other thread, it seems he specified that while the syntax could eventually work the way you/he wrote it to allow for comparing more than one value in a single If tag, there currently isn’t support for that syntax. Seems this might be added eventually, but won’t work for now.

1 Like