An update.

I have noticed that if I add a <$log statement to the wikitext to try and 
debug what is going on, I expect to see two entries in the dev console but 
I see four (there are two marked artworks for the test run). Is this the 
result of trying to write twice into the exhibition tiddler in the middle 
of a $list run? Does this force two passes of the $list loop?

bobj

On Thursday, 1 October 2020 at 21:17:21 UTC+10 Bob Jansen wrote:

> I am trying to implement two simple functions but can not work out the 
> wikitext. Tones, I have tried following your cheat sheet but nothing I try 
> appears to work.
>
> One over arching question. When I use a $list statement to produce a 
> subset of available tiddlers and then go through each in turn, does TW act 
> like a loop, for each iteration I am focussed on a single defined tiddler 
> from the subset? If so, how is this loop tiddler addressed, by 
> <<currenttiddler>> or does this refer to the calling tiddler?
>
> This has bearing on the second of my functions, below.
>
> <code>
> <$macrocall 
>      $name="edit-list" 
>      tiddler="$:/TLS/exhibition_id"
>      listview="{{{ [<value>get[exhibition_name]] }}}" 
>      filter="[tag[Exhibitions]!tag[Index]]" 
> />
> <$list filter="[tag[Mark]]">
>      <!--append exhibition_id to exhibition_id of each marked artwork 
> tiddler-->
>      <$action-setfield 
>           $field="exhibition_id" 
>           $value={{{ [{!!exhibition_id}addsuffix[ 
> ]addsuffix{$:/TLS/exhibition_id}] }}}
>      />
>      <!--append each artwork_id to artwork_id of the exhibition tiddler-->
>      <$action-setfield 
>           $tiddler= {{{ [{$:/TLS/exhibition_id}] }}}
>           $field="artwork_id" 
>           $value={{{ [{!!artwork_id}addsuffix[ 
> ]addsuffix{$:/TLS/artwork_id}] }}}
>      />
> </$list>
> </code>
>
> The first action-setfield correctly adds the selected exhibition_id to the 
> exhibition_id field of each artwork tiddler selected through the filter.
>
> For the second action-setfield, I am trying to append the artwork_id from 
> the current artwork tiddler selected through the filter to the artwork_id 
> field of the exhibition record determined by the exhibition_id selected 
> above. This does not work, I only see the artwork_id of the last artwork 
> record so either the append isn't working (but it is an identical statement 
> that worked in the first action-setfield statement) or I am not seeing each 
> artwork tiddler in turn, only the last one (hence my question above wrt to 
> loop processing or I can not address the tiddler whose id is stored in 
> $:/TLS/exhibition_id whilst iterating through a list of marked artwork 
> tiddlers.
>
> Also, I need to amend the action-setfield statements so that if the 
> artwork_id or exhibition_id already exist in the corresponding tiddler 
> field, then the append does not take place. I assume that I need to use a 
> conditional operator but can not work out the format of the statements. 
> Eric has provided an example of this type of processing in the past but I 
> can not find it.
>
> bobj
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/11d108d6-e04f-4b5f-a009-4ec508b8d1den%40googlegroups.com.

Reply via email to