A List of All Tags?

Sooo… I went a little tag happy, and not just in Drafts, mind you. I would really like an easy way to create a Draft that contains a list of all the tags I have used so that I can get a better overall picture of them and begin to combine and pare them down before I use filters to get to the Drafts which contain that specific tag or set of tags.
I could take screenshots, I guess. I could also just create a new Draft and tap on each of the tags to add it to that document, I guess. But then wouldn’t that affect the sorting? I don’t know. If this isn’t actually a feature request, and instead is just my not thinking clearly, please excuse.
I had a brain injury in 2009 and occasionally my experience of app developers’ logic is very different from the developers’ own experience of their logic enough that I find myself in these types of forums a lot. :slight_smile:
Thanks in advance for your patience and assistance.

[NDRS]

This action should put all of your tags on separate lines in alphabetic order in a new draft and load that draft into the Drafts editor.

It uses a single script action with the second line doing most of the heavy lifting.

let draftNew = Draft.create()
draftNew.content = [...new Set([].concat(...Draft.query("", "all", []).map((currentDraft) => currentDraft.tags)))].sort();
draftNew.content = draftNew.content.replace(/,/g, "\n");
draftNew.update();
editor.load(draftNew);
editor.activate();

Hope that helps.

2 Likes

Would it be easily possible to add a count of each tag?

Sure. This would do it across all (non-Trash) folders.

let draftNew = Draft.create()
for (let strTag of [...new Set([].concat(...Draft.query("", "all", []).map((currentDraft) => currentDraft.tags)))].sort())
{
	draftNew.content += strTag + " (" +  Draft.query("", "all", [strTag],[], "created", true, false).length + ")\n";
}
draftNew.update();
editor.load(draftNew);
editor.activate();
3 Likes

Oh, my gosh! That is amazing! Thank you so much! :pray: Namaste!

NDRS

This is amazing. I’m so impressed that you were just able to create this script like that. I don’t even know where I would begin to try to learn how to do that. I’ve spent my life trying to learn to do stuff that is helpful to others, and creates actual value in the world. I mean … I’m not even funny.
I’ve started to try to learn through “Swift Playgrounds”, I’ve tried really hard to learn how to do ‘Workflows’ before they were ‘Shortcuts’ in iOS. They very rarely work.
When I was a kid, my mom bought me a Texas Instruments TI 99-4A ‘game’ console that was also a very basic computer. I did all this studying to learn ‘T.I. Basic’ and I wrote a game in like a couple thousand lines of code with no way to save the code. If I turned off the console, the code would have been gone. But so I coded the whole thing and left the console on, and my mom drove me an hour to a hobby store to go buy the cassette tape recorder that I needed to save the program.
Well, plugging the thing in crashed the console.
I think ever since then I’ve been really kinda defeatist about learning coding in any serious way. I should get over that if I can. I have a fairly logical mind, and I could probably do pretty well at it if I would learn how.
Anyway. Heartfelt thanks from a random stranger on the Internet.
~NDRS~

and is there a quick way to sort by frequency ? :slight_smile:

A quick method, as in quick to describe? Yes…

Move the frequency to prefix the tag name rather than append it, and sort it. Just not alphabetic vs numeric sorting, or zero pad the frequency.