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/6c584ccb-9e70-48a8-a5b1-9427cc0d571bn%40googlegroups.com.