Hi Tobias,

I can see it's not easy to explain my use case.

In some occasions I find it easier to pass some parameters to a template. 
It allows me to write more generic templates and re-use them in different 
contexts

So inside the template I put some placeholders for variables to be defined, 
like $(somevariable)$.
When the variables are defined when the template is called, it works fine. 
But I'd like to be able to call the template without defining all the 
variables : to have default values.

The default value of a variable is supposed to be used by the template when 
the variable is not defined when the template is called.

So inside the template I have to check whether the variable is defined or 
not :
If the variable is defined, that's fine, let's use its value.
If not, the default value is affected to the variable.

The set widget allows to affect a value to a variable according to the 
result of a filter (empty list of tiddlers or not). So I tried to go this 
way.
But my problem was to design the filter. I ended with a fancy filter.
I was wondering if there is a better way to do that :
- using something else than the set widget with the filter and emptyValue,
- or using a more straightforward filter.

I hope it's a bit clearer now ?

FrD

Le samedi 19 septembre 2015 16:54:28 UTC+2, Tobias Beer a écrit :
>
> Hi Frd,
>  
>
>> But it's twisted and I was wondering if there was a simpler way to 
>> specify a default value.
>>
>
> A "default" how? When your filter returns empty, then you have 
> *emptyValue* to cater for a default.
> Otherwise at what point do you want your default to kick in if not for 
> when your computed value is blank?
>
> So, I don't see why your third expression would declare a value parameter,
> because I don't see when that would ever kick in.
>
> Best wishes,
>
> — tb
>

-- 
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/fb8b83c7-93dd-42f0-a4cd-2b6dae2fc91b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to