Getting a list of all the tags in a tinderbox document

Hi everyone,

I am trying to clean up an older tinderbox document during the “early days”. I am afraid and must admit I did not enforce my tag vocabulary (part of my incremental formalization). Anyway, I now want to clean it up.

How would I get a list of all my tags so that I can copy them to the clipboard and create a new document to begin to work with them.

Thanks

The action code values() is your friend. It takes as input the name of the desired attribute, without a $ prefix. The action returns a de-duplicated list - i.e. one instance of each (case-senstive) value used; unused suggested values are omitted. To save fiddling with export, the easy method is to get the list and then format it into the $Text of a note, one value per line. You can then copy the values form the note and delete the note.

Thus to get a list of all discrete $Tags values in your document, make a new note and give it this edict(an edict so it’s not running all the time):

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

Obviously, if you want a different target attribute (system or user) simply replace ‘Tags’ with the desired attribute name.

More on values().

Perfect. Will review values as you suggested. Many lessons here: 1. use of values() …so useful, 2. combined use of values() and sort() 3. practical example of a very useful edict for me.

As always, thank you again
Tom

1 Like

On the timeless principle that “if there’s one way to do it in Tinderbox, there are probably six more as well,” here is another route toward a similar destination. The approach by @mwra is of course the clearest way to see a list of values. Here is a way to get a different kind of info, using our old friend, the Attribute Browser:

  • Open an AB view of the container you’re interested, or of the whole file.

  • When specifying how you’d like the AB view to be grouped and presented, chose the attribute whose full range of values you would like to see.
    In the image below, I am working with a user-created attribute call $Location. This is a file of interview notes, which I tag with source, date, themes, and some other attributes, including $Location. (I’ve blanked out parts of the subject lines.) So if you were looking for the built-in attribute called $Tags, where my image shows User / Location, yours would show Reference / Tags. (Because $Tags is in the References sub-group of built-in attribtes.) If you were looking for a new attribute you’d created called $Tag [no “s”], this dialog line would show User / Tag.

  • You also can specify, on that top line, whether you’d like the query to apply to the file as a whole, or any container or sub-container therein. (In my image, it’s the /NOTES container, which includes all of my relevant data.)

  • There are curlicues in the Attribute Browser that let you narrow down the query – for instance, showing only notes that have some value for $Location (or $Tags), so you’re not seeing a big group of notes listed under [No Value].

  • But the bonus of this approach is that you’ll see a categorization of all your values, and you’ll see the specific notes that have those values assigned. If you want to change or remove the assignments, you can see just where to start. [Reprising a separate discussion, you’d have to make those re-assignments via an agent, or in the outline view, since you can’t directly select multiple notes in the AB. But this lets you know where you stand.]

Onward for many paths toward any given destination.

I’d add two more features I use a lot with AB view:

  • You can have column data (as with Outline view).
  • You can display counts of each of the primary attribute values, e.g. in the grab above 1 of Albuquerque, 5 for Allentown, etc. The count, if used is shown at the right hand end of the header bar for each value.

Sadly you can’t export (or show except in AB view) the values and their occurrence count, though this is a current feature request.

Thanks James and Mark

Great suggestions for using the AB for this task as well. Seems like a very nice fit for this task.

thanks again
Tom

This is great. Thank you for asking this, TomD, and for your helpful answers, Mark and James. I’d been thinking of posting a similar question.

I’ve gotten a list of tags using the Edict, which I’ll copy to Scapple to brainstorm and refine the tags, then will use the Attribute Browser method to apply these to notes.

Thank you all.

As you are tidying your tag list you might find it useful to bring the ‘clean’ list back into your document in a new User Set-type attribute, using the new list as suggested values. This makes all values available via a KA value pop-up list even if no note yet uses them. Unused suggested values are ignored by values() and by AB view.

Note, if you’re (re-)setting values for the attribute used to create the main listing, be aware AB view isn’t on a hair-trigger refresh. In a large document you’ll need to wait a (short!) while or do a tab focus switch in order to force a refresh of the per-value listings in the AB view.

Very nice. I will experiment. Thank you so much, Mark.