Actually, if you are trying to test the contents of a list (List or Set type data), then the string you weant to test should be a smei-colon-joined set of values:
"Smith;Duncan".contains($LastName) & $Prototype=="Expert";
Separately and although it does no harm, whilst agent queries are written in action code they should not include a semi-colon at the en d as in a normal action code expression. Luckily, if you make that mistake, Tinderbox ignores the error, though it is an error—i.e. try to avoid it.
However, these aren’t the problem with you agents. This:
$Experts.contains($LastName) & $Prototype=="Expert"
Is testing each note’s $Experts against its $LastName. Assuming you are trying to test export names stored in the agent’s $Experts, the query would be this:
$Experts(agent).contains($LastName) & Prototype=="Expert"
Note the use of the ‘agent’ designator in the first part of the query. This method allows you to alter the agent query simply by altering the values for the agent’s $Experts attribute. This is easily done if $Experts is added to the agent’s Key Attributes.
This is a different solution to the one above, and a good example of how Tinderbox offers multiple routes to a solution. Both work, only you can judge what suits best.
To make it easy to play with both examples, I have modified the above file (and its filename). Before adding a link, here are the changes:
- I’ve given the prototype a $Color and a $Badge value so it is easier to see which notes use a prototype.
- I’ve moved the test cases into a container ‘People’
- I’ve added some non-export people inlcuding one with a $LastName that would match the $Xperts test but fails the $Prototype one.
- I added a second agent using the logic described above.
Here’s the file (kudos for the original demo concept goes to @PaulWalters): Experts Agent 20200306a.tbx (105.2 KB)