vpl,

You may need the temporary value stored for some reason, but sometimes it 
is possible to simply calculate it each time you need it. 

For others reading this thread the macros from vpl and Eric are used inside 
a trigger such as the button widget to get the action-setfield to work.

Tones 

On Saturday, 28 November 2020 at 07:24:34 UTC+11 vpl wrote:

> Arghhhh how do you do that ... like a magic wand that tells you that you 
> will not be able to redo it yourself ...
>
> Many thanks. It works perfectly
>
> Regards
>
> Le vendredi 27 novembre 2020 à 20:42:43 UTC+1, Eric Shulman a écrit :
>
>> On Friday, November 27, 2020 at 10:06:00 AM UTC-8 vpl wrote:
>>
>>> When I run the below code, the <<currentTiddler>> is not the *title *of 
>>> the filtered tiddler but the date value !!! So at the end the 
>>> action-setfield is applied on new tiddler whose title is the date value and 
>>> not my existing 'test-1" tiddlers.
>>>
>> \define my_test()
>>> <$list filter="[tag[test-1]get[date]compare:date:gt{!!testval}]">
>>>        <$action-setfield $tiddler=<<currentTiddler>> $field="tempid" 
>>> $value="44444"/>
>>> </$list>
>>> \end 
>>>
>>
>> Split the filter into two separate $list widgets, like this:
>> \define my_test()
>> <$vars testval={{!!testval}}>
>> <$list filter="[tag[test-1]]">
>>    <$list filter="[<currentTiddler>get[date]compare:date:gt<testval>]" 
>> variable="checkdate">
>>       <$action-setfield tempid="44444"/>
>>    </$list>
>> </$list>
>> </$vars>
>> \end 
>>
>> Notes:
>> * $vars gets the testval from the tiddler in which the macro is invoked
>> * the first $list finds all tiddlers with the desired tag and sets 
>> currentTiddler
>> * the second $list compares the date of the currentTiddler to the testval
>> * the second $list uses the variable="..." syntax to avoid changing the 
>> value of the currentTiddler
>> * $action-setfield sets the tempid field value in the currentTiddler
>>
>> enjoy,
>> -e
>>
>

-- 
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/7c93c01f-f7cd-4f83-9b7b-723fb817cc00n%40googlegroups.com.

Reply via email to