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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/3783fd9b-c82b-4684-8b50-9a4e539f5272n%40googlegroups.com.