I simplified my test.

Definitely, the update is postponed. And also, the updating mechanism is 
nos broken in 5.1.23, it was a mistake of mine because of what I report 
here below.

demo code:
====
\define just-do-it()
<$set name=seen filter="[<target>get<dest>]">
<$action-log $$message="before update" $$filter="target dest seen"/>
</$set>
<$action-setfield $tiddler=<<target>> $field=<<dest>> $value=<<foo>>/>
<$set name=seen filter="[<target>get<dest>]">
<$action-log $$message="after update" $$filter="target dest seen"/>
</$set>
\end

<$vars target="Community" dest=ndx>
<$set name=foo value=1848>
<$button actions=<<just-do-it>>>
set <<foo>> into <<target>>!!<<dest>>
</$button>
</$set>
<$set name=foo value=1789>
<$button actions=<<just-do-it>>>
set <<foo>> into <<target>>!!<<dest>>
</$button>
</$set>
<br>current value: <$transclude tiddler=<<target>> field=<<dest>>/>
<br>See <$link to=<<target>>/>
</$vars>
====

see screen capture showing the console output!

[image: update-field.png]
Le vendredi 23 avril 2021 à 19:03:20 UTC+2, Jean-Pierre Rivière a écrit :

> Yes. Fine !!!
>
> But on my 5.1.23, it seems to be tgat the action of $action-setfield is 
> not immediate but postponed to the end of the action (ie when the matro 
> called by actions=<<my-macro>> has terminated).
>
> This is problematic for me as I was trying to increment a value within a 
> loop by using  $action-setfield in an action setup.
>
> I have tried my code on your new wiki, but I can't make it function in any 
> way. I don't know why yet. I'm waiting for your answer about the moment 
> when the field modification take place before trying anew (it might not be 
> useful...)
>
> regards
>
> Le vendredi 23 avril 2021 à 17:30:21 UTC+2, [email protected] a écrit :
>
>> Hi Jean-Pierre
>>
>> In my quick test creating a new tiddler on tiddlywiki.com/prerelease and 
>> entering the following, and then clicking the button, everything worked as 
>> expected.
>>
>> <$button>
>> <$action-setfield $tiddler="HelloThere" $field=bar $value=42/>
>> test
>> </$button>
>>
>> Best wishes
>>
>> Jeremy
>>
>> On 23 Apr 2021, at 16:22, Jean-Pierre Rivière <[email protected]> 
>> wrote:
>>
>> Hi!
>>
>> I found out that to update to 42 the value of field "bar" in tiddler 
>> "foo" I *must* use the syntax
>>
>> <$action-setfield $tiddler=foo bar=42/>
>>
>> and that the following has no effect that I cam see:
>>
>> <$action-setfield $tiddler=foo $field=bar $value=42/>
>>
>> although I would have thought both as valid from reading the doc.
>>
>> Is that normal (under tw5.1.23)? What does achieve the second form?
>>
>>
>> -- 
>> 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/a13a6c5f-6cb1-46f5-a059-77999f19305en%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tiddlywiki/a13a6c5f-6cb1-46f5-a059-77999f19305en%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/c37f5525-1f12-4fd7-9d5f-4070d62e190en%40googlegroups.com.

Reply via email to