How to create this agent?

I’m trying to create an agent whose the request would be the following one: gather all the notes whose one tag has the most high recurrence. For instance, if the tag “object” has 50 instances and 50 is the highest number of recurrences among my notes. What could the code to insert in my request? Thanks for your suggestions!

It is worth clarifying exactly what ‘tag’ means here.

So does this mean all notes have one, and only one tag? Otherwise several notes might all have the highest tag re-use.

Or is this finding the most-used individual ‘tag’ count, i.e. the tag value with the highest occurrence?.

If the last, an easy way to sketch things is to use Attribute Browser. Here, for path of /Content/Test cell/(and descendants), we have listed the categories (individual discrete $Tags values and show their use count, and sorted in count value descending:

Otherwise it might help us help you if you can be more specific as to what needs to be measured.

Note: the category counts visible in Attribute Browser view are not accessible in action code—at least not directly (i.e. without being calculated first by other means)

1 Like

I would suggest breaking this task into separate steps. Each might be done by a different object.

  1. Build a list of tags and their frequency of use in order to identify the most common tag. I think this might best be done by a rule or edict on some note. Store the most common tag in a convenient place, such as $MyString(/configuration/tags/common)

  2. Now, your agent can look for notes that its this tag.

2 Likes

Thank you for your suggestions. I’m going to keep my habits with the Attribute Browser. What I was trying to get with an agent – and not the Attribute Browser – was a permanent updated list of notes where one of the tags has the highest frequency. But finally, it leads me to the same thing if I use the Attribute Browser.