Eg:

<$list filter="""[<variable>length[]match[9]then[short]else[long]]""" 
variable="type"/>

{full code here}

</$list>

On Wednesday, May 20, 2020 at 6:28:11 PM UTC+2, Saq Imtiaz wrote:
>
> Many combinations of list and set widgets can be used, but this basic idea 
> is probably what you need:
>
> [<variable>length[]match[9]then[short]else[long]]
>
> On Wednesday, May 20, 2020 at 6:19:59 PM UTC+2, Tony K wrote:
>>
>> I can't figure out how to set the value of a variable based on a specific 
>> condition so, instead, I am writing the code twice
>>
>> e.g.
>>
>> <$list filter="[<variable>length[]match[9]]">
>> <$set name="type" value="short">
>> {full code here}
>> </$set>
>> </$list>
>> <$list filter="[<variable>length[]!match[9]]">
>> <$set name="type" value="long">
>> {full code here}
>> </$set>
>> </$list>
>>
>> this is not really efficient. 
>>
>> I tried conditionally inserting the first line of the "$set" but it 
>> didnt' work (as follows) even thought logically it should 
>>
>> <$list filter="[<variable>length[]match[9]]">
>> <$set name="type" value="short">
>> </$list>
>>
>> <$list filter="[<variable>length[]!match[9]]">
>> <$set name="type" value="long">
>> </$list>
>>
>> {full code here}
>> </$set>
>>
>>
>> I am sure there is some kind of a workaround for this
>>
>> thanks for shedding any light 
>>
>

-- 
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/f8cf441b-a86b-490d-bf74-4a337bde3ce0%40googlegroups.com.

Reply via email to