Hi S.S,
 This is great!
You can visually and interactively play with $set and see the result!

Thank you

On Friday, April 5, 2019 at 4:50:39 AM UTC+4:30, S. S. wrote:
>
>
> The set widget is very useful for choosing between multiple options.
> Understanding the logic of what combinations of the $set widget's 
> attributes produce the desired outcome is essential to using it for such a 
> requirement.
> The discussion above was quite a revelation.
>
> Here's a possible use.
>
> If A is not empty, chose A
>    If A is empty, chose B
>       If B is empty, chose C
>          If C is empty, chose D
>
> A real case secenario occurred within the date() macro 
> <https://groups.google.com/forum/?hl=en#!topic/tiddlywiki/_bbDpiiReic>:
>
> In the macro, I wanted to choose a template based on:
> If there is a *template-day* parameter ( *$template-day$* )
>    Use that 
>    If NO *template-day* parameter
>       Use the *template* parameter ( *$template$* )
>       If NO *template* parameter
>          Use the *Custom Settings* field value (stored in    tiddler: 
> *date-settings-tiddler*    field: *template-day* )
>          If NO *Custom Settings*
>             Use the template *default variable* ( 
> *<<template-day-default>>* )
>
> <$set name="temp" tiddler="date-settings-tiddler" field="template-day" 
> emptyValue=<<template-day-default>>>
>    <$set name="temp-template" filter="[enlist[$template$]]" 
> value="$template$" emptyValue=<<temp>>>
>       <$set name="template" filter="[enlist[$template-day$]]" 
> value="$template-day$" emptyValue=<<temp-template>>>
>
>          Code using <<template>>
>
>       </$set>
>    </$set>
> </$set>
>
> Note how the $set flow is an exact reverse of the logical requirement, 
> where the most important variable ( *template-day* ) is tested last.
>
> So, for those interested, attached is a: Set Widget Tester for attribute 
> precedence tiddler.
> Drag & drop it into your TiddlyWiki or tiddlywiki.com & hopefully quickly 
> check the result of any combination of the set widget's parameters.
>
> Regards.
>
>
> On Monday, April 1, 2019 at 10:26:24 PM UTC+7, Jeremy Ruston wrote:
>>
>> Hi SS 
>>
>> That’s great, thank you. 
>>
>> > Testting shows: If there is a value attribute & no emptyValue 
>> attribute, the value is returned irrespective of the filter's result. 
>>
>> I can confirm that behaviour, and I think it’s a bug. But… I’m not 100% 
>> sure that we should fix it; it might be better just to revise the docs at 
>> this point (the observed behaviour is simpler to describe in the docs). 
>>
>> Best wishes 
>>
>> Jeremy 
>>
>>

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b7ce7fa0-be71-4adf-80ec-5195c13341c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to