Tony K
Ok, I do not understand the original question then however perhaps these
could help?
- Have you tried to use set, its filter and emptyValue which should
remain until the closing set?
- Can you ask the question in a different order?
- Or can you generate a subset of variables from a list such as "short
long N(for length)" then have additional nested lists to interogate these
and respond to each differently.
In this case emptyMessge/value is never triggerd, the result has more
testing done to it. eg if not short not long
Regards
TonyM
On Thursday, May 21, 2020 at 2:26:25 PM UTC+10, Tony K wrote:
>
> Hello Tony
>
> Your patience is remarkable thank you so much
>
> yes I am aware that an empty messaeg can be a macro however I wasn't able
> to make it set the value of the same variable for the rest of the code like
> explained by Saq and yourself in the if-then-else scenario
>
> the second issue I faced is the <longeval> cannot take arguments which
> turned out to be documented
>
>
> On Thursday, May 21, 2020 at 4:44:02 AM UTC+3, TonyM wrote:
>>
>> TonyK
>>
>> An empty message can be a macro, that contains many things,
>>
>> \define onemptymessage()
>> {empty message code here}
>> \end
>>
>> <$list filter="""[<variable>length[]match[9]then[short]else[long]]"""
>> variable="type" emptyMessage=<<onemptymessage>> />
>>
>> {full code here}
>>
>> </$list>
>>
>>
>> It can even look like this
>>
>> <$list filter="""[<variable>length[]match[9]then[short]else[long]]"""
>> variable="type"
>> emptyMessage="""
>> {empty message code here}
>> """/>
>>
>> {full code here}
>>
>> </$list>
>>
>> Extending Saq suggestion; I expect this to work (untested today)
>>
>> [<variable>length[]match[9]then<shortval>else<longval>]
>>
>> The only limitation being macros cant be passed variables, complex macrs
>> may need their result wikified before using in a filter
>>
>> Remember as well is all you want to know is is it long or short this will
>> do
>>
>> {{{[<variable>length[]match[9]then[short]else[long]]}}
>>
>>
>> Regards
>> Tony
>>
>> On Thursday, May 21, 2020 at 2:32:40 AM UTC+10, Tony K wrote:
>>>
>>> I did play around with empty message but it gives an empty message and
>>> doesn't set a value to a variable (at least from my tests)
>>>
>>> On Wednesday, May 20, 2020 at 7:26:41 PM UTC+3, Mark S. wrote:
>>>>
>>>> The list widget has an emptyMessage attribute. You can point this to a
>>>> macro where alternative actions occur when the main filter fails (is
>>>> empty).
>>>>
>>>> In your second set of widgets, you have unmatched tags/tag endings
>>>> which is always a bad thing.
>>>>
>>>> Good luck!
>>>>
>>>> On Wednesday, May 20, 2020 at 9:19:59 AM UTC-7, 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/dd181380-dd2c-4e37-93db-415a9ae4e5ac%40googlegroups.com.