Query for multiple tags in a note

(Helmut Sperber) #1

The agent should find notes which have tags like ''TOPIC1" OR “TOPIC2”.

This should be
$Tags.contains (“Topic1”|“Topic2”)

But the result is only “Topic1”. Topic2 cannot be found.
The topics are separated with ; in the tags-filed.
Any ideas?

(Mark Anderson) #2

Multi-value attributes (List and Set) only allow literal string matches of discrete values when using .contains(). Don’t have time to test this instant, but this should work:

$Tags.contains("Topic1") | $Tags.contains("Topic2")


  • there should be no space in .contains(..., i.e. not .contains (...
  • use straight, not curly quotes in action code, though I suspect here this is due to the forum software ‘correcting’ quotes for typographic effect.

Tip, for all forum users. If quoting action code, always select the code and use the ‘code’ button (</>) in the formatting bar of the box for writing new posts. this stops anything messing with your code such as changing quote types.

(Helmut Sperber) #3

Thank you, Mark
I understand: No multi-values in a query for XX.contains(). We must have two (or, if wanted, more) conditions/queries separated with OR; or whatever we want.
I have tested your advice. And it works the way I expected.
Thank you once again for your help.