$list versus $action-listops

I’m a bit confused as to the difference between these two functions and when either should/could be used.

Can anyone shed some light?

I have a simple script:

<$button>

<$action-listops $subfilter="[tags[]search[,]search[q]]" />
<$action-createtiddler 
     $basetitle=<<currentTiddler>>
     tags="Person"
     overwrite="yes" 
/>

Go
</$button>

I want this script tp find all tag values containing a comma and the letter q and then create a new tiddler for each with its title being the value of the tag and having a tag, Person, overwriting any that may already exist.

The above script just creates a single new tiddler, titled New Tiddler, with tag Person. So I assume the issue is that the list is either not gone through (there should be about 6 candidates) or the new tiddler is created and overwritten six times.

Should I be using $list instead of $action-listops?

bobj

The $action-listops widget is used to modify a tiddler field (defaulting to the list field) that contains a space-separated, bracketed list of items. Think of it as a specialized form of $action-setfield that can add/remove/re-order the contents of a field containing a list. Because it is an $action widget, it is only performed in response to a $button press (or a limited set of other widgets that perform actions, such as an $eventcatcher widget).

In contrast, the $list widget is used to “loop” over a set of values (usually tiddler titles) in order to produce output or perform actions (if contained within a $button widget) on each title/value. In general, it is processed whenever it is rendered, without requiring a $button press. However, when it DOES occur within a $button widget and encloses any $action widgets, those actions are only processed when the $button is pressed.

Thus, for your script, you definitely want to use the $list widget:

<$button> Go
   <$list filter="[tags[]search[,]search[q]]">
      <$action-createtiddler $basetitle=<<currentTiddler>> tags="Person" overwrite="yes"/>
   </$list>
</$button>

-e

Hey, that works, thanks @EricShulman

bobj

@EricShulman , so how would I filter that first list, use a second $list / </$list statement within the first <$list / </$list statement?

I remember seeing something about that in my searching but can’t find it again.

bobj