Hey @avanti, I finally had a dev look into this a little and discovered something interesting about why
not works but
is_not doesn’t, despite the fact that
is_not is what’s documented as a comparison for the
If tag. Here’s what I heard from a dev:
I looked at the code on how the
singular condition is being checked. I believe it’s intended that
is_not does not work with
singular. In fact, I believe all the comparisons do not work with
singular because when I check the logic rules,
singular does not contain any operands. However, a
not check is separate from this.
not can always be used to negate the calculated value of each condition. So whatever the value calculated is, true or false, if there’s a
not, it will become false or true respectively.
I thought that was pretty interesting. So I think
<If not singular type="project"> or
<If singular not type="project"> are fine ways to write this in this case and isn’t a bug, it’s just making use of a “secret”
not attribute that makes true logic false and false logic true. If you wanted to strictly stick to documented stuff, I suppose the other option would be to do
<If singular type="project"><Else />... but that seems a little more awkward.
I’ve asked if it would be possible to make
If singular for with the
is_not comparisons so we’ll see if we can make that a bit more intuitive/consistent in the future. But I figured you might want to know that using the
not attribute is fine in this case and understand why that’s the case.