Need your help / comment: Batch operation

131 views
Skip to first unread message

Mohammad

unread,
Jan 22, 2019, 1:39:23 AM1/22/19
to TiddlyWiki
One question frequently raised by newbies is batch operation e.g how to tag all tiddlers have certain title, ...

I am preparing a section in TW-Scripts called Batch Operation
Batch operation means do operation on all tiddlers meet certain criteria.

Certain criteria means like below

  •  all have special tag
  •  all have certain field
  •  all have certain words in their title
  • ...
Operation means

  • Delete all tiddlers meet certain criteria
  • Delete a certain field from all tiddlers tagged e.g. myTag
  • Add a new tag to all tiddler has certain words in their title
  • ...


please help to complete this section. Give your idea on batch operation, and certain criteria can be done with TW

How do you like to arrange different parts in this section?

--Mohammad

Mohammad

unread,
Jan 22, 2019, 4:23:34 AM1/22/19
to TiddlyWiki
Also see
 Batch Manipulator by Mat von TWaddle



--Mohammad 

S. S.

unread,
Jan 22, 2019, 4:48:11 AM1/22/19
to TiddlyWiki
I am assuming you are looking for ideas on how to do a help presentation tiddler.

The way I use the logic is:

<$list filter="criteria-fitler">
  <$macrocall action
</$list>

Messages list a tiddlywiki.com
\define action such as:
<$button
 
<$action-sendmessage $message=  
 
Press Button
</$button

For what you are proposing, you could display different filters.
Maybe in a table, left column : Criteria & right column : Filter

Example: Make a list of Normal Tiddlers (not System or Shadows) to perform actions on:

Criteria
Filter
A tag: myTag :filter="[tag[myTag]]"
Has both a tag for BOTH audio AND video :filter="[tag[audio]tag[video]]"
Has a tag for EITHER audio OR video :filter="[tag[audio]] [tag[video]]"
A title starting with: Word :filter="[all[tiddlers]prefix[Word: ]]"
An empty text field :filter="[all[tiddlers]!has[text]]"
Does not have a modified field:filter="[all[tiddlers]!has[modified]]"
Has a field called: author , but that field is NOT empty :filter="[all[tiddlers]has:field[author]]"
Has a field called: author , but that field is empty :filter="[all[tiddlers]has:field[author]!has[author]]"
etc.

Next, make a list of common actions that are performed. Common action messages perhaps:

  tm-add-field , tm-add-tag , tm-delete-tiddler , tm-new-tiddler ,  tm-remove-field , tm-remove-tag

Then comes the harder part - trying to explain the $action-sendmessage part.
<$action-sendmessage $message="tm-new-tiddler" title="New $title$ Tiddler" tags="$input$ $ExtraTags$" $param="$:/_/template/$template$"/>


Thomas Elmiger

unread,
Jan 22, 2019, 6:54:35 AM1/22/19
to TiddlyWiki
Please make sure to integrate a hint on the built-in Advanced search options (delete, export).

Maybe including the possibility to add your own solutions to the filter menu via https://tiddlywiki.com/#SystemTag%3A%20%24%3A%2Ftags%2FAdvancedSearch%2FFilterButton

(Or would this be a separate chapter? Then link to it.)

Cheers,
Thomas

Mohammad

unread,
Jan 22, 2019, 8:37:23 AM1/22/19
to TiddlyWiki
Hello S.S.
Many thanks for your comments. I absolutely will use them. Also I made a link to the valuable tutorial (manual) you prepared for Tiddlywiki at



By the way, In TW-Scripts I go through examples. I call it "learn by example". Here I want to have a section with some tiddlers explaining the batch operation in TW.
So, the table you have given below is quite useful for my case. I am trying to explain what kind of criteria we can have and what kind of batch operation we can do!

Thank you again.
Mohammad

Mohammad

unread,
Jan 22, 2019, 8:38:25 AM1/22/19
to TiddlyWiki
Hi Thomas,
 Many thanks for your hint! 
Surely I add it! For bulk delete and export, this Filter tab is quite useful.

--Mohammad

S. S.

unread,
Jan 22, 2019, 12:05:56 PM1/22/19
to TiddlyWiki
Mohammad,

Please allow me to request you not to make any lasting links to https://00ss.github.io/help/Adding-a-table-of-contents-to-the-sidebar.html
That TiddlyWiki is just a working copy of tiddlers that are being made for discussion so that they can be used as a set of beginner's Introduction on the official tiddlywiki.com website.
Once they are included there, that TiddlyWiki will serve no purpose any more.

Mohammad

unread,
Jan 22, 2019, 12:31:58 PM1/22/19
to TiddlyWiki
Hello S.S,
No problem, I will remove the link.

--Mohammad

TonyM

unread,
Jan 22, 2019, 6:53:23 PM1/22/19
to TiddlyWiki
Mohammad,

My Previous contribution to the scripts is in fact a demo of the first of a set of possible batch manipulation examples.

Here are a few more that illustrate the examples you are looking for, it is simply a matter of changing the selection filter and the action widget. Som action widgets have the $filter parameter, others do not and you need a list.

<$list filter="[has[dummy]]"></$list>


<$button>
<$action-deletetiddler $filter="[tag[dummy]]"/>
Delete Tiddlers tagged
</$button>


<$list filter="[has[dummy]]"></$list>


<$button>
<$list filter="[has[dummy]]">
<$action-deletefield $field="dummy"/>
</$list>
Delete Field in tiddler
</$button>


<$button>
<$action-deletetiddler $filter="[has[dummy]]"/>
Delete Tiddlers with field
</$button>

Whilst this shows the code if we were to package it for new users, not people learning tiddlywiki, we would always ensure we list what the button will effect. Make a macro and enable the filter to be passed (not hard coded). 

It would be quite easy to make a large set of these and make them available for almost every conceivable batch action, however if we are to go down this path we should decide exactly what we will provide so we can do it consistently and not face rework later.

Regards
Tony

Mohammad

unread,
Jan 22, 2019, 11:07:12 PM1/22/19
to TiddlyWiki
Hi Tony,
 Many thanks for your contribution.
It is added to TW-Scripts.

Cheers
Mohammad
Reply all
Reply to author
Forward
0 new messages