Tinderbox Forum

How do I get an agent to create text only in its own text field?

Hi, all,
I recently screwed up a number of notes with a well-intentioned agent and I’m trying to figure out what I should have done instead. What I wanted was a list of all the Tags I had assigned to notes for a sub-project within a larger Tinderbox document. So the agent was
Query: $ForSubproject==true (to capture all notes with that Boolean attribute checked)
Action: $Text = values(“Tags”).format("\n");

This yielded an agent containing aliases of all the relevant notes. Its text was a tidy list of all the values of Tags that that list of notes contained.

Problem is, of course, that the the agent affected the text of every note for which the query was true. In other words, the list of attributes replaced the text of every note the agent collected.

Pretty dumb, in retrospect. But here’s what I can’t figure out: What would have been the right way to do this? How could I have instructed the agent to collect all $ForProject=True and generate the list of Tag attributes only in its own text field and not in every note it collected? I am sure it is glaringly obvious how to tell an agent to do something to its own text and not the text of all its notes. But I can’t figure it out.

Thanks!

David

Ok, what you need to set is the Text attribute of the agent. To do this in the context of the agent’s action, you want to use the ‘agent’ designator. So your agent action becomes:

$Text(agent) = values("Tags").format("\n");

In the wider context, take a moment to read more about designators. There are number of them, some for single items, some for groups of times and most are used for this sort of ‘offset’ addressing of attributes in other notes.

You are probably most familiar with setting an attribute in the current note an attribute in another note. for example:

$MyString = $MyString("Another note");

They don’t have to be the same-name attribute (though the data being fetched must make sense to the target attribute). thus:

$Text = $MyString("Another note");

Your question uses the less common form of a left-side offset:

$MyString("Some note") = $MyString;
$Text("Some note") = $MyString;
$Text("Some note") = $Text;

I hope that helps answer the opening problem and given you some ideas to open that issue out a bit. :slight_smile:

. Note that in Tinderbox what you refer as a ‘field’ is generally called an ‘attribute’. I only mention this as it may help when trying to look things up in the various documentations.

Thank you, Mark! That’s very helpful – not only for this immediate problem but as a path for learning how to make better, finer-grained agents.

Appreciate it!

best,

David

1 Like