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.

Reply via email to