Hi Saq,
 Many thanks for both solutions. The second is more semantic and I use it.

Best wishes
Mohammad



Best wishes
Mohammad


On Mon, Dec 14, 2020 at 5:31 PM Saq Imtiaz <[email protected]> wrote:

> OR:
>
> <$action-listops $tiddler="$:/palette" $field="text"
> $filter="""[{$:/palette}!match[$:/palettes/Vanilla]!match[$:/palettes/SolarFlare]then[$:/palettes/Vanilla]]
> :else[enlist{$:/palette}toggle[$:/palettes/Vanilla],[$:/palettes/SolarFlare]]"""
> />
>
> On Monday, December 14, 2020 at 2:41:13 PM UTC+1 Saq Imtiaz wrote:
>
>> Hmm. Yes it is a bit tricky since toggle[] is a list ops operator. So you
>> need to handle the situation where this is an existing value that is not a
>> part of the value pair to toggle. I'm short on time at the moment so there
>> might be a better solution, but something like this untested solution
>> should work:
>>
>> <$action-listops $tiddler="$:/palette" $field="text"
>> $filter="""[enlist{$:/palette}] -$:/palettes/Vanilla
>> -$:/palettes/SolarFlare :and[then[$:/palettes/Vanilla]]
>> :else[enlist{$:/palette}toggle[$:/palettes/Vanilla],[$:/palettes/SolarFlare]]"""
>> />
>>
>> On Monday, December 14, 2020 at 1:44:42 PM UTC+1 Mohammad wrote:
>>
>>> I use the below button to toggle between day/night palette
>>>
>>> <$button>Day/Night
>>> <$action-listops $tiddler="$:/palette" $field="text" 
>>> $subfilter="+[toggle[$:/palettes/Vanilla],[$:/palettes/SolarFlare]]" />
>>> </$button>
>>>
>>> The problem here is if $:/palette is not empty and has not one of the
>>> two values above, then I get the wrong values in the text field (actually
>>> the value is appended). How can I replace the field value using toggle
>>> operator.
>>>
>>>
>>>
>>> Best wishes
>>> Mohammad
>>>
>> --
> 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/2a806757-e69c-4838-9b16-04a38f57bbe7n%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/2a806757-e69c-4838-9b16-04a38f57bbe7n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAAV1gMAa5pFtmT5HV4U8qWV4WQ9Hyo%2B3hb%3DLhHQw1hkeVirK4Q%40mail.gmail.com.

Reply via email to