Tinderbox Forum

Agent query using agent's $Name?

Hi there,

I’m a newbie, using TinderBox for a Zettelkasten. I’m curious if it is possible to have an Agent query return aliases when the $Text of notes contains the $Name of that Agent.

Example scenario:
Agent $Name = #vegetarian
Note A $Text contains “#vegetarian
Note B $Text contains “#meat
Note C $Text contains “#vegetarian

In this scenario, the agent named “#vegetarian” would then contain aliases for Note A and Note C.

Right now I’m using a prototype to create agents with the same query, which contains a placeholder (i.e., “INSERTKEYWORDHERE”). If possible, I’d like to save myself the step and just have the name of the agent be the criteria it searches other notes against.

Thanks for the guidance!

Not at my Mac to test this, but I’m pretty sure you’re looking for the agent designator

So the query would look like this:

$Text.contains($Name(agent))

This is a good trick you can use in all sorts of ways to create agents in this way you are talking about. Create an agent called “Tags” the set this query:

$Tags.contains($Tags(agent))

Then, you just set the tags of the agent to be what you want to find. In other words, looking for notes tagged “fish” and “chips”? Set the agent to have those tags and it will find notes with them.

Now, you might need to work on the operator. “Contains” is different from == , so okay around with these to get what you want.

At my Mac and confirming @derekvan’s answer, except the second sample which wouldn’t work if $Tags(agent) had more than one value. Re .contains() vs == , see more:

Gentlemen,

You’re geniuses–thank you: this is exactly what I needed.

I went with the first scenario [$Text.contains($Name(agent))] because I want to be able to insert the “tags” as ZipLinks. ZipLinks feels a little easier/more fluid than updating an attribute for each note and will easily allow me to tag notes to multiple keywords if needed. (I may come to regret this later–we’ll see!).

Thank you!

2 Likes