<$list filter="[<a>then<b>else<c>]>
</$list>
<$list filter="[<a>else<b>]">
</$list>
<$list filter="[[<a>] ~[<b>]]">
</$list>
I am wondering how to use filter operator THEN, ELSE and ~(else)Why the below fails
<$list filter="[<a>then<b>else<c>]>
What is the difference between else and ~?
<$list filter="[<a>else<b>]">
and
<$list filter="[[<a>] ~[<b>]]">
Generate/list titles > then[hastitles]else[notitles]
So the above coded as a filter will only ever return hastitles or notitles.
The ~ on the other hand does test for empty list as well and can return a single title or new list.
Along with match these new operators will allow us to write filters more logically and in more natural language, I would say plain English like but the titles can be any language.
By being able to generate a string/title output on ones choosing from a filter, the wiki text can have further tests to respond to the generated result.
Happy to post examples as I collect them for myself.
Tony
[<a>then<b>else<c>]
Basicaly you are using three variables as titles and you are relying on an empty variable to be the same. In your example you are only testing for the existence of a and returning either b or c.
This may be what you want?
tony
<$list variable=template filter="[tag[a]] ~[tag[b]] ~[[tid3]]">
<$transclude mode=block tiddler=<<template>> />
</$list>
<$list variable=template filter="[tag[a]else[tid2]else[tid3]]">
<$transclude mode=block tiddler=<<template>> />
</$list>
<$list variable=template filter="[tag[a]else<variable-holding-tid2>else{field-holding-tid3}]">
<$transclude mode=block tiddler=<<template>> />
</$list>
<$list filter="[<a>then<b>else<c>]">
</$list>
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/8a4a3a6b-5050-416e-85f9-9f31bfb5b8c1%40googlegroups.com.
[<currentTiddler>]
will retrieve the value of the variable called currentTiddler
. New in: 5.1.20 is[variable]] test exists as a variable (whether or not that variable has a non-blank value) | |
blank |