Re: [tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-15 Thread Mohammad Rahmani
> > Saq et al, > > I love these semi-competitive focused coding task threads. I like to > generalise and simplify too, > I love these kind of scripting, as I learn new things ;-) > As a result I seem to have identified that the new toggle operator and > parameters is not accepting this form

[tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-15 Thread TW Tones
Post script, In another project I am using unicode and I would call the night-day tiddler night-dayⒷ then if you search night or day this is listed and indicates its a button. {{night-dayⒷ}} Regards tones On Wednesday, 16 December 2020 at 10:28:37 UTC+11 TW Tones wrote: > Saq et al, > > I

[tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-15 Thread TW Tones
Saq et al, I love these semi-competitive focused coding task threads. I like to generalise and simplify too, As a result I seem to have identified that the new toggle operator and parameters is not accepting this form (as in Saq's example) text={{{[{$:/palette}toggle,< darkPalette>] }}}/>

Re: [tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-15 Thread Mohammad Rahmani
Hi Saq, Yes, dropping the list makes sense! Your last solution seems the simplest by now ;-) I will document this in TW-Script when I find free time! Cheers Mohammad On Tue, Dec 15, 2020 at 12:40 PM Saq Imtiaz wrote: > @Mohammad yes the toggle operator is best used with list fields. > >

[tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-15 Thread Saq Imtiaz
@Mohammad yes the toggle operator is best used with list fields. You can further simplify and skip the list widget: <$vars lightPalette="$:/palettes/Vanilla" darkPalette="$:/palettes/SolarFlare" > <$button>Day/Night II <$action-setfield $tiddler="$:/palette"

[tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-15 Thread Mohammad Rahmani
It seems in this case there are other simple solutions too, while in my opinion toggle is the most semantic one but in its current implementation is tricky to use for toggling a field can be changed outside the script. These are other solutions that do not use toggle but very simple. Of course

Re: [tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-14 Thread Mohammad Rahmani
Saq, Based on your suggestion, this may be another solution (not a good one but works!!) <$button>Day/Night II <$list filter="[{$:/palette}!match[$:/palettes/Vanilla]!match[$:/palettes/SolarFlare]]"> <$action-setfield $tiddler="$:/palette" $field="text" $value=""/> <$action-listops

Re: [tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-14 Thread Mohammad Rahmani
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 wrote: > OR: > > <$action-listops $tiddler="$:/palette" $field="text" >

[tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-14 Thread Saq Imtiaz
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

[tw5] Re: [TW 5.1.23] Toggle filter operator how to replace the field value

2020-12-14 Thread Saq Imtiaz
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