I'm not sure if I understand 100% what you want, but your first example had 
a couple problems. The first was that the <$set> was missing a "Value" 
attribute. The 2nd was that the filter chosen was guaranteed to have a 
match, so the default would never get selected. The following works at 
least in a very simple way:

<$set name="param" value="myvalue">
   <$set name="vi" filter="[field:title<param>]" 
emptyValue="defaultisinourstars" value="ok">
     <$text text=<<vi>>>
   </$set>
</$set>

If there is a tiddler that matches "myvalue", then "ok" is selected. If 
not, the emptyValue is selected. 

It helps to use the "filter" option of the advanced search when trying to 
figure out what kind of inputs the filter is looking for.

Mark


On Sunday, October 25, 2015 at 7:46:49 AM UTC-7, Erwan wrote:
>
> Hi again everyone, 
>
> use case: I want to build MyTemplate which shows a link to the current 
> tiddler, with the text of the link being either a specific value given 
> as parameter, or "title" by default. 
>
> So I'm trying to assign a variable "v" with the value of variable 
> "param" if "param" is defined, or some default value otherwise. I tried 
> this: 
>
> <$set name="param" value="myvalue"> 
>    <$set name="v" filter="[<param>]" emptyValue="default"> 
>      <$text text=<<v>>> 
>    </$set> 
> </$set> 
>
> but it doesn't work. I also tried various combinations like: 
>
> <$set name="v" filter="[<param>]" value=<<param>> emptyValue="default"> 
>
> but that would assign either "myvalue" or nothing instead of 
> "default"... I'm confused. 
>
> I guess another way to phrase the question is: how can I check whether a 
> variable has a value or not? 
>
> Regards 
> Erwan 
>
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/727b51e3-a05b-4919-adf3-bd1911263a48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to