[TW5] Add dynamic tags based on list filter results

210 views
Skip to first unread message

ruddb

unread,
Mar 13, 2014, 8:00:27 AM3/13/14
to tiddl...@googlegroups.com
I cannot make this work:

-----------------------------------------------------------------------------------------------------------------------
\define newCheckbox(n_title)
<$checkbox tag="$n_title$"> $n_title$ </$checkbox>
\end

<$list filter="[!is[system]tag[timebox]projectthread{!!projectthread}sort[title]]">
<$macrocall $name="newCheckbox" n_title={{!!title}}  />
</$list>
-----------------------------------------------------------------------------------------------------------------------

It shows the checkbox and the correct title beside them but clicking on the checkbox does not result to an update of the tag.

Please advise.

Thanks.


Matabele

unread,
Mar 13, 2014, 10:31:39 AM3/13/14
to tiddl...@googlegroups.com
Hi

Works as you would expect with a simple filter expression:

\define newCheckbox(n_title)
<$checkbox tag="$n_title$"> $n_title$ <
/$checkbox>
\end

<$list filter="[tag[help]]">


<$macrocall $name="newCheckbox" n_title={{!!title}}  /
>
</$list>

Must be a problem with your filter expression.

regards

TheDiveO

unread,
Mar 13, 2014, 10:43:33 AM3/13/14
to tiddl...@googlegroups.com
<$list filter="[!is[system]tag[timebox]projectthread{!!projectthread}sort[title]]">

 "projectthread" doesn't look like a valid operator to me.

Stephan Hradek

unread,
Mar 13, 2014, 11:03:53 AM3/13/14
to tiddl...@googlegroups.com


Am Donnerstag, 13. März 2014 15:43:33 UTC+1 schrieb TheDiveO:
<$list filter="[!is[system]tag[timebox]projectthread{!!projectthread}sort[title]]">

 "projectthread" doesn't look like a valid operator to me.

It's the shortcur of "field:projectthread"

ruddb

unread,
Mar 13, 2014, 11:04:36 AM3/13/14
to tiddl...@googlegroups.com
Hi Harald,

The field "projectthread" is a custom field I added to the tiddler. 
The filter works somehow because I can see the 'title' of the filtered tiddlers as the name of the checkbox. Only that it does not trigger the tag change action.


Hi Matabele,

As to the simpler filter, let me try that one. I am using the template list filter I use with another function but you are right, maybe the other parts are not that necessary.


On Thu, Mar 13, 2014 at 9:43 PM, TheDiveO <harald....@gmx.net> wrote:
<$list filter="[!is[system]tag[timebox]projectthread{!!projectthread}sort[title]]">

 "projectthread" doesn't look like a valid operator to me.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/89htVN-Dzx4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Stephan Hradek

unread,
Mar 13, 2014, 12:26:11 PM3/13/14
to tiddl...@googlegroups.com
The question is: Where would you expect the tag to appear.

I tried it on tiddlywiki.com and the tag appear at the tiddler where you found the projectthread field.

So if I have a "overview" tiddler with your list and a "New Tiddler" with a projectthread field sharing the value with the overview field, I set a tag "New Tiddler" in the "New Tiddler" tiddler.

Is that what you wanted?

Stephan Hradek

unread,
Mar 13, 2014, 12:39:26 PM3/13/14
to tiddl...@googlegroups.com
If you want the tag to be set on the "overview" tiddler, use this:

\define newCheckbox(n_title)
<$checkbox tiddler="$(thistiddler)$" tag="$n_title$"> $n_title$ </$checkbox>
\end

<$set name="thistiddler" value={{!!title}}>

<$list filter="[!is[system]tag[timebox]projectthread{!!projectthread}sort[title]]">
<$macrocall $name="newCheckbox" n_title={{!!title}}  />
</$list>
</$set>

ruddb

unread,
Mar 13, 2014, 12:43:00 PM3/13/14
to tiddl...@googlegroups.com
Hi Stephan,

I created examples in http://onewikinote.tiddlyspot.com/

Search for:
TagDemo - is using my filter
TagDemo2 - is using the simple filter
Tag1
Tag2
Tag3

What I expect, when I check 'Tag1' it should add the 'Tag1' tag on the TagDemo tiddler, and so on...


ruddb

unread,
Mar 13, 2014, 12:44:43 PM3/13/14
to tiddl...@googlegroups.com
Hi Stephan,

Tried your solution on the TagDemo3 and it works :) Thanks!


ruddb

unread,
Mar 13, 2014, 12:47:27 PM3/13/14
to tiddl...@googlegroups.com
Hi Stephan,

Just for my understanding, why the old code does not work when the checkbox tag value is defined in the macro? Why it is needed to specify the 'overview tiddler'?

Stephan Hradek

unread,
Mar 13, 2014, 1:09:40 PM3/13/14
to tiddl...@googlegroups.com
Because the checkbox widget sets the tag on the currentTiddler which happens to be the one you got the !!title from.

<$set name="thistiddler" value={{!!title}}>
<!-- here the currentTiddler still is your overview tiddler -->

<$list filter="[!is[system]tag[
timebox]projectthread{!!projectthread}sort[title]]">
<!-- here the current tiddler is the "just found" tiddler -->
<!-- this allows you to use !!title in the macrocall below -->

ruddb

unread,
Mar 13, 2014, 1:19:27 PM3/13/14
to tiddl...@googlegroups.com
Thanks! Clear and it does make sense. 
Reply all
Reply to author
Forward
0 new messages