Thanks Tones. While I did not investigate those options properly I’d think they’d reqire several filter runs in the filter expression which would make it long (I didn’t state that brevity was desired for the filters but it is somewhat important for legibility in this case).
… and it’s even more concise than your previous function-based solution!
Note also that, while \procedure can be used to declare variables that contain simple text values, I prefer to use the old (but still valid) \define syntax for this purpose, since it makes it clear that this is just defining a convenient abbreviation for a longer text value.
i.e. if get doesn’t return anything because the field is empty, the else will add an empty item to the list which will not match yes and thus work as required. This is how I often do this kind of thing.
I do like @EricShulman’s solution better though, which I used to implement before forgetting about its existence (repeatedly). Also, since it returns the input tiddler instead of the field contents (if not empty), it is limited to such yes/no cases as yours, but requires an additional get to grab the actual contents of the field if you want to do something else with it.
Also, Eric probably meant to use the negated !bar[yes] to match your logic, or flip the correct and error logic (which would be a little easier to understand for me) in his example.
BTW, I also keep using \define for simple string assignments.