I was in need of checking if a macro parameter was empty. The following is a extremely simplified version of the actual code:
\define isStringEmpty(str) <$set name="answer" filter="""$str$""" value="no" emptyValue="yes"> <<answer>> </$set> \end The result was not as I expected: Macro call Result <<isStringEmpty "something">> no <<isStringEmpty "">> no After a lot of attempts I realized that this one: <$set name="answer" filter="" value="no" emptyValue="yes"> ... behaves just like: <$set name="answer" value="no"> I mean it seems that having the *filter* parameter of the *SetWidget* set to an empty string, is just like not having it at all, therefore the *emptyValue* parameter is ignored and it falls back to the basic syntax ( *name*, *value*). It is probably obvious for the one more experienced with Tiddlywiki and HTML, I think it's a consequence of the way the widgets are parsed (as I could understand, quite like normal HTML tags). For me and the ones used with traditional programming languages, a variable set to an empty string is... an empty value! I found a workaround and I decided to share my experience for who should fall in the same trouble, since I spent a lot of time to understand what happend, why and how to resolve. \define isStringEmpty(str) <$set name="answer" filter="""[enlist[$str$]]""" value="no" emptyValue="yes"> <<answer>> </$set> \end Passing the string as a parameter of *enlist* filter operator do the trick. [enlist[]] evaluates to an empty list (it could be easily tested in *AdvancedSearch*), as expected by the *SetWidget* while using conditional assignment: Macro call Result <<isStringEmpty "something">> no <<isStringEmpty "">> yes Hope this could help someone. -- 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/effc9243-bc39-4ffd-a327-7890f09f39dd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

