How to add tag A to all tiddlers with tag B

74 views
Skip to first unread message

Harry

unread,
Dec 7, 2020, 12:41:46 AM12/7/20
to TiddlyWiki

Hi all,

I have a question about adding tags. I have finished creating 800+ tiddlers and now need to add additional tags to some of them. What I want to do is that for all tiddlers that already have been tagged "NV-senator", I want to also tag them with "NV-legislator". Is there a way that I can do that in a batch? I found some posts on creating a button, but am really confused as a newcomer.

After that, I also want to attach tag "NV-legislator" to all tiddlers with tag  "NV-rep" . The complication is that some tiddlers may have already been tagged with both  "NV-senator" and  "NV-rep" , and therefore would have already been tagged with  "NV-legislator" . If I replicate the same process with what I did for the "NV-rep" tags, would it be a problem that the command may try to add "NV-legislator" tag to some tiddlers that already have it?

Really appreciate all the help!

Eric Shulman

unread,
Dec 7, 2020, 1:00:43 AM12/7/20
to TiddlyWiki
On Sunday, December 6, 2020 at 9:41:46 PM UTC-8 Harry wrote:
for all tiddlers that already have been tagged "NV-senator", I want to also tag them with "NV-legislator".
I also want to attach tag "NV-legislator" to all tiddlers with tag  "NV-rep".

Try this:
<$button> add tags
   <$list filter="[tag[NV-senator]] [tag[NV-rep]]">
      <$action-listops $tags="NV-legislator" />
   </$list>
</$button>

Notes:
* The $button label is "add tags".  The button actions (the $list and $action-listops) are only performed when the button is clicked.
* The $list filter finds all tiddlers tagged with either NV-senator OR NV-rep.  Note that duplicates are automatically removed from the filter results.
* For each tiddler found, $action-listops adds the NV-legislator tag to the existing tags
* The tags list of any given tiddler are always unique, so even if you press the button again, it will not add a duplicate tag

enjoy,
-e

Harry

unread,
Dec 8, 2020, 10:34:39 PM12/8/20
to TiddlyWiki
Thanks a lot, this really helps me resolve the issue!

Best
Harry
Reply all
Reply to author
Forward
0 new messages