Hi FrD,

Thank you for your solution, it's clever!

However I would prefer a simpler way if possible: if I use this, I'm sure that I won't remember what it means when I read it again later...

Erwan

On 25/10/15 21:18, FrD wrote:
Hi Erwan,

I have a solution, but not a very elegant one :

\define myFilter()
a$(param)$ +[removesuffix[a]]
\end

<$set name="v" filter=<<myFilter>> value="default" emptyValue=<<param>>>
     <$text text=<<v>>/>
</$set>


<$set name="param" value="myValue">
<$set name="v" filter=<<myFilter>> value="default" emptyValue=<<param>>>
     <$text text=<<v>>/>
</$set></$set>

FrD

Le dimanche 25 octobre 2015 15:46:49 UTC+1, Erwan a écrit :

    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] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[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/20f6a317-f339-49b5-931e-e5b17794d116%40googlegroups.com <https://groups.google.com/d/msgid/tiddlywiki/20f6a317-f339-49b5-931e-e5b17794d116%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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/562D8312.9060606%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to