A non-existent variable is assigned a value of "", i.e a non empty string. Which is not the same as no result from the filter step.
There is also the is[variable] operator. On Sunday, November 22, 2020 at 5:27:35 PM UTC+1 [email protected] wrote: > I'm trying to create a template that will take a value from a variable, if > present, or from a field of the current tiddler if the variable isn't > defined. My first try was this filter: > > {{{ [<articleName>else{!!myarticle}] }}} > > To my surprise, the *else* doesn't work -- the filter works as expected > if articleName is defined (the value of the variable articleName is > output), but the output is just empty if articleName isn't defined, instead > of containing the value of the *myarticle* field. > > But this does work as expected: > > {{{ [<articleName>!is[blank]else{!!myarticle}] }}} > > I don't follow *why* this works and the first version doesn't, though, > and I couldn't find much in the manual about this, so I would be grateful > if someone could enlighten me. Is there a difference between an > empty-string item and an empty list, and the title constructor yields an > empty-string item when used this way? Are there other situations when I > should have this in mind? > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/ca8a71e1-4efe-49cd-a944-562ed45e8cf1n%40googlegroups.com.

