Agent Action - differ in text parsing

I submit a simple tbx-file with 4 notes and two agents. The agents search for 2 specific notes each and have, in my mind, the same actions, agent B
$Text=$Text+"$ID is: “+^value($ID)^+” and $IDString is: "+^value($IDString)^;

the other, agent A
$Text=$Text+"$ID is: “+^value($ID)^;
$Text=$Text+” and $IDString is: "+^value($IDString)^;

just split the agent B’s action into two parts.

Agent A’s action results in the correct;
$ID is: 1683206780 and $IDString is: tbx:BkU7J8

Agen B’s action results in this
$ID is: 1683206813+\" and $IDString is: \"+tbx:BkU7Kd

which seems to be a parsing error.

Agent Action - differ in action .tbx (111.2 KB)

Using export code in action code has long been deprecated. Though i’m not sure the exact cause, this incorrect user of export code is the cause of the problem, but we can fix that. In action code don’t use ithis:

^value($ID)^

but the action code equivalent:

$ID

You have a further error in that $ID and $IDString are intrinsic so both attributes are different in the alias (in the agent) as opposed to the alias’ original. In the grab of aNote 1, the Displayed Attributes shows the original’s values which different from those in the note’s text was they are derived from the alias:

In the edited note below I have fixed:

  • The ID values are from the original, not the alias.
  • Replaced the use of export code in action code.
  • Made the action not re-add the txt every agent cycle.

Fixed document: Agent Action - differ in action-ed .tbx (117.7 KB)

BTW, was there a particular source that made you use ^value($ID)^ and not $ID. no judgement there, i’m just keen to remove/update incorrect examples/documentation. :slight_smile:

Thanks for rapid response.
My concern was not about the $ID’s and $IDString’s but just that I consider the resulting string from agent B to be incorrect, in adding the “plus-backslash-quote” to the string.

You are of course correct that my use of ^value()^ is incorrect. However, even after correcting this the resulting text string is still in error.

No it work, I just had a typo from converting the Agent A action, which should be:

$Text="$ID is: "+$ID(original);
$Text+=" and $IDString is: "+$IDString(original);

Revised TBX (with above fix): Agent Action - differ in action-ed2.tbx (117.7 KB)

Sorry about the typo, I’m actually deep in a complex task in my day job, so haven’t time to do a complex tear down and test. The error in my last was this line:

$Text+=$Text+" and $IDString is: "+$IDString(original);

The second $Text+ was unneeded old code I forget to remove when updating the agent action.

Thank you again for taking the time.
Yes, it works! (So this item can be closed)

It seems that I have problems with the update sequence of the actions. I do a change in the action rule, hit return, but sometimes the changes do not stick and other odd things happens. But save to another day and se if I can bring some order in what I see.

Again, thanks for all the help you provide me.

Changing an action 9e.g. in the Inspector) doesn’t force the agent to update immediately. You can:

  • select the query inspector. Either of these causes Tinderbox to think the query has changed and re-run the agernt (and thus action code too):
    • click in the code area and press theR return key.
    • on the query inspector, toggle the query to ‘off’ and the3n back to ‘normal’.
      in the file menu choose “Update Agent Now”.

The latter is fine for a small doc but in a big one it causes all agents to run again (plus other things). So for bigger/more complex docs the Inspector-based methods might be more useful.

Aha, “Update Agent Now” seems fine to me.
Thank you for that tip.

1 Like