[TW5] ListopsWidget how to add [[ automaticly and how to make -<<currentTiddler>>

177 views
Skip to first unread message

sini-Kit

unread,
Jan 18, 2016, 5:48:13 AM1/18/16
to tiddl...@googlegroups.com
Hi! I try to understand how to   work with ListopsWidget . I try to find all tidders with field nazvane:test (I have 3) and put their titles to field "myfield" in test tiddler.

here is my code 

<$reveal type='nomatch' state='$:/state/someuniquenameforthisstuff' text='checked'>
 <$button class='tc-btn-invisible'>☐ Is it done?
<$list filter='[nazvanie[test]]'>
<$action-listops $tiddler="test" $field="myfield" $subfilter=<<currentTiddler>>/>
</$list>
<$action-setfield $tiddler='$:/state/someuniquenameforthisstuff' text=checked/>
</$button>
</$reveal>
<$reveal type='match' state='$:/state/someuniquenameforthisstuff' text='checked'>
 <$button class='tc-btn-invisible'>☑ Is it done?
<$list filter='[nazvanie[test]]'>
<$action-listops $tiddler="test" $field="myfield" $subfilter="+-<<currentTiddler>>"/>
</$list>
<$action-setfield $tiddler='$:/state/someuniquenameforthisstuff' text=unchecked/>
</$button>
</$reveal>

<$view tiddler="test" field="myfield"/>

   it works, but it don't add [[to titles with space]] and it don't work with -<<currentTiddler>>  I try with "", but I didn't help.


how can I modify my code to make it work in a proper way?

Matabele

unread,
Jan 18, 2016, 8:17:07 AM1/18/16
to TiddlyWiki
Hi

The $subfilter= and $tags= attributes are designed to input a subfilter expression run, and take as their input the current content of the target field, setting the value of the target field to the output of the subfilter.

The ActionListops widget also has a $filter= option, which is designed to input a full filter expression (in this case "[nazvanie[test]]"): then the value of the target field will be set to the output of this filter. I haven't added the $reveal widgets and visual indicator, in order to keep the example clear:

<$button>
<$action-listops $tiddler="test" $field="myfield" $filter="[nazvanie[test]]"/>
Set myfield With Titles
</$button>

I'm not sure what the lower button is supposed to do? Perhaps clear the 'myfield' field -- in which case:

<$button>
<$action-listops $tiddler="test" $field="myfield" $filter="[[]]"/>
Set
myfield With Empty List
</$button>

regards

Matabele

unread,
Jan 18, 2016, 8:28:40 AM1/18/16
to tiddl...@googlegroups.com
Hi

The full code for a fake checkbox is then:

<$reveal type="match" state="!!temp" text="set">
<$button set="!!temp" setTo="reset" class='tc-btn-invisible'>
<$action-listops $tiddler="test" $field="myfield" $filter="[nazvanie[test]]"/>
<input type=checkbox/>Set</$button></$reveal>
 
<$reveal type="match" state="!!temp" text="reset">
<$button set="!!temp" setTo="set" class='tc-btn-invisible'>
<$action-listops $tiddler="test" $field="myfield" $filter="[[]]"/>
<input type=checkbox checked/>Reset</$button></$reveal>

-- the value of the !!temp field will need initialising with "set"

regards

On Monday, 18 January 2016 12:48:13 UTC+2, sini-Kit wrote:

Matabele

unread,
Jan 18, 2016, 9:06:52 AM1/18/16
to TiddlyWiki
Hi

Now, to remove only the currentTiddler from the target field, the $subfilter= attribute must be used to modify the current contents of the target field:

<$button>
<$action-listops $tiddler="test" $field="myfield" $subfilter="-[{!!title}]"/>
Remove Current Title
</$button>

If you wish to remove a list of titles, there is the option of using the remove[] filter operator, which can accept a TextReference +[remove{Text!!reference}] as a parameter.

<$button>
<$action-listops $tiddler="test" $field="toremove" $filter="[my[filter]]"/>
<$action-listops $tiddler="test" $field="myfield" $subfilter="+[remove{!!toremove}]"/>
Remove Filtered Titles
</$button>

regards

On Monday, 18 January 2016 12:48:13 UTC+2, sini-Kit wrote:

Matabele

unread,
Jan 18, 2016, 9:13:18 AM1/18/16
to tiddl...@googlegroups.com
Hi

Or, of course you might prefer to iterate through the list with a $list widget:

<$button>
<$list filter="[my[filter]]" variable="remove">
<$action-listops  $tiddler="test" $field="myfield" $subfilter="-[
<remove>]"/>
</$list>
Remove Filtered Titles
</$button>

regards

On Monday, 18 January 2016 12:48:13 UTC+2, sini-Kit wrote:

sini-Kit

unread,
Jan 19, 2016, 9:56:56 AM1/19/16
to TiddlyWiki
 Thank you Matabele! Last variant is the best. I put it to my experiment macros but I don' know how to solve last problem.

 I make a list of checkboxes, and try to uncheck  them all by one button.

 <$button class='tc-btn-invisible' > <input type="checkbox" checked="true">
<$list filter='[tag[$:/Note]has[$name$]]' variable="add">
<$action-listops  $tiddler="$:/temp/_HideStoryList" $field="list" $subfilter="[<add>]"/>
</$list>
<$list filter='[prefix[$:/state/someuniquenameforthisstuff]]'>
<$fieldmangler tiddler=<<currentTiddler>>>
<$action-setfield $tiddler=<<currentTiddler>>   text='checked'/>
</$fieldmangler>
</$list>
</$button> -  uncheck all

 but it work only if all $:/state/someuniquenameforthisstuff$(TestVariable)$ are ready. but all of the will be created only if I check all my checkboxes. And it is not good. Is it possible not to do <$list filter='[prefix[$:/state/someuniquenameforthisstuff]]'> but create all $:/state/someuniquenameforthisstuff$(TestVariable)$ with text "unchecked"?



понедельник, 18 января 2016 г., 17:13:18 UTC+3 пользователь Matabele написал:

Matabele

unread,
Jan 19, 2016, 10:23:41 AM1/19/16
to TiddlyWiki
Hi sini-Kit

Had a look at your experimental wiki -- you 'check all' and 'uncheck all' buttons seem to work. I can't work out what problem you are trying to solve.

regards

sini-Kit

unread,
Jan 20, 2016, 1:16:04 AM1/20/16
to TiddlyWiki
Please look again my experimental macros  I make 2 same variants (work\ don't work) for the first variant "states" are ready for second not. I want "check all" button not to look for existing states and change their "text", but create them new by mask <$action-setfield $tiddler='$:/temp/state/filpar/$name$/$(TestVariable)$' text='unchecked'/> . is it possible?

вторник, 19 января 2016 г., 18:23:41 UTC+3 пользователь Matabele написал:

Matabele

unread,
Jan 20, 2016, 4:54:19 AM1/20/16
to TiddlyWiki
Hi

Haven't solved your problem -- but if you use this code, you'll see that, in the second case, the variables aren't as expected.

\define thisList(name)
<$reveal type='nomatch' state='$:/temp/state/filpar/$name$/$(TestVariable)$' text='checked'>

<$button class='tc-btn-invisible' > <input type="checkbox" checked="true">
<$list filter='[tag[$:/Note]$name$[$(TestVariable)$]]' variable="add">

<$action-listops  $tiddler="$:/temp/_HideStoryList" $field="list" $subfilter="[<add>]"/>
<
/$list>
<$action-setfield $tiddler='$:/
temp/state/filpar/$name$/$(TestVariable)$'  text='checked'/>
</$button> -  $(TestVariable)$
</$reveal>
<$reveal type='
match' state='$:/temp/state/filpar/$name$/$(TestVariable)$' text='checked'>
<$button class='
tc-btn-invisible'  > <input type="checkbox" >
<$list filter='
[tag[$:/Note]$name$[$(TestVariable)$]]' variable="remove">
<$action-listops  $tiddler="$:/
temp/_HideStoryList" $field="list" $subfilter="-[<remove>]"/>
</$list>

<$action-setfield $tiddler='$:/temp/state/filpar/$name$/$(TestVariable)$' text='unchecked'/>
</$button>  - $(TestVariable)$ ?
</$reveal>
\end

\define filpar(name)
<$list filter="
[is[current]tagging[]tag[$:/Note]each[$name$]get[$name$]]" variable="something">
<$set name=TestVariable value=<<something>> >
<$macrocall $name="thisList" name="$name$"/
> <br>
</$set>
</
$list>

<hr>

<$reveal type='nomatch' state='$:/temp/state/filpar/$name$' text='checked'>
<$button  set='$:/temp/state/filpar/$name$' setTo='checked' class='tc-btn-invisible' >
<$list filter='[tag[$:/Note]has[$name$]]' variable="add">
<$action-listops  $tiddler="$:/temp/_HideStoryList" $field="list" $subfilter="[<add>]"/>
<
/$list>
<$list filter='[prefix[$:/temp/state/filpar/$name$]]'>

<$action-setfield $tiddler=<<currentTiddler>>   text='checked'/
>
</$list>
<input type="checkbox" checked="true"> -  uncheck all</
$button>
</$reveal>
<$reveal type='match' state='$:/
temp/state/filpar/$name$' text='checked'>
<$button set='
$:/temp/state/filpar/$name$'  setTo='unchecked' class='tc-btn-invisible' >
<$list filter='
[tag[$:/Note]has[$name$]]' variable="remove">
<$action-listops  $tiddler="$:/
temp/_HideStoryList" $field="list" $subfilter="-[<remove>]"/>
</$list>
<$list filter='[prefix[$:/temp/state/filpar/$name$]]'>
<$action-setfield $tiddler=<<currentTiddler>>   text='unchecked'/>
</$list>
<input type="
checkbox" >  - check all</$button>
</$reveal>
\end

<<filpar nazvanie>> '''work!'''

<<filpar stoimost>> '''don't work :('''

I suspect the problem lies here: 

<$list filter="[is[current]tagging[]tag[$:/Note]each[$name$]get[$name$]]" variable="something">
<$set name=TestVariable value=<
<something>> >
<$macrocall $name="thisList" name="$name$"/>
<br>
</$set>
</$list>

regards

sini-Kit

unread,
Jan 20, 2016, 7:49:37 AM1/20/16
to TiddlyWiki
Thank you, Matabele! You give me a good idea and I solve problem. I simple add a new define

\define thisList2(name)
<$action-setfield $tiddler='$:/temp/state/filpar/$name$/$(TestVariable2)$' text='checked'/>
\end


......................

 <$button class='tc-btn-invisible' > <input type="checkbox" checked="true">



<$list filter="[is[current]tagging[]tag[$:/Note]each[$name$]get[$name$]]" variable="nazvanie">
<$set name=TestVariable2 value=<<nazvanie>> >
<<thisList2 $name$>>
</$set>
</
$list>

</$button> -  uncheck all







среда, 20 января 2016 г., 12:54:19 UTC+3 пользователь Matabele написал:
Reply all
Reply to author
Forward
0 new messages