Doh, the answer whilst simple is perhaps not intuitive until after the fact. the core issue here is testing if a string ($Name of a note) matches any single value in a list ($Actor). You can't do that in action code - in that manner.
But, as a list is stored as a single string of concatenated values, so the latter can
contain, as a sub-string, the single item being compared. Sorry, that's convoluted. this may make it clearer. Let's say we have $MyString of "cow" and a $MyList (or $MySet) of 3 values with a stored string of "ant;bee;cow".
$MyString.contains($MyList) fails because if seen as literal strings:
("cow").contains("ant;bee;cow")is false. But, reverse things and test $MyList.contains($MyString) and we have success:
("ant;bee;cow").contains("cow")So one 'error' in the original code was the test was reversed, you need to test $Actor(that).contains($Name). It may not seem like it but you are essentially asking , for the one currently tested "Does its $Name equal [sic] any value in the $Actor of the note calling the find()". Or in pseudocode: $Name==anyValueOf($List(that)).
Sidenote: Apologies for the long explanation (and which I'll abstract to relative parts of aTbRef in due course) but I think it useful for later readers.Having fixed that, it exposes a further problem. If understood correctly you want to make agent-based maps where the items on the map (not their originals) are linked - visibly. Originals and aliases can have their own
discrete links. so, you need to do the linking via the agent action and not via a rule note as the latter runs in the original and in all the aliases. In testing, it seems hard to get the rule to distinguish if it is linking an original or an alias without giving very specific paths. However, ...
Luckily, we can do this via an agent. Note, this depends on a change early in v6.x whereby 'that' was correctly applied in an agent action. If we make our agent action this:
linkTo(find($Actor(that).contains($Name) & $IsAlias),"agree"); Each plan note
alias on the agent map, links to the current map
alias of any actor notes listed in the plan's $Actor attribute. Importantly, it doesn't link to actors in $Actor that aren't matched by the agent query, i.e. aren't included in the current map.
My test TBX is
here (zip).
Edit: forgot to add don't think you'll need to update past the current v6.6.1 to do this. Agent actions correctly evaluate the 'that' designator as from v6.5.0.