>
>
> 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?
>
>
Within a $list widget, it does indeed act like a loop, and currentTiddler 
is the default variable name for the tiddler in the current position in the 
loop.
You can change this by specifying a variable parameter for the list widget. 
Then currentTiddler variable can still be used to access the "calling 
tiddler".

<$list filter="[tag[Mark]]" variable="mark">


<<mark>> is the tiddler in the current position in the loop
<<currentTiddler>> is the "calling tiddler" / value of currentTiddler 
outside the list loop.


</$list>


Another approach is to save the value of currentTiddler outside the list 
loop in a different variable name, and then access within the list by that 
name.

<$vars targetTiddler=<<currentTiddler>> >
<$list filter="[tag[Mark]]">



<<currentTiddler>>  is the tiddler in the current position in the loop
<<targetTiddler>> "calling tiddler" / value of currentTiddler outside the 
list loop.


</$list>
</$vars>


To make a conditional assignment you can just wrap an action-setfield 
widget in a list widget that tests for the condition you want.
<$list filter=....filter with my condtion.... variable="_null">
<$action-setfield ....
</$list>


Your filter should be one that only produces an output when your conditions 
are satisfied and otherwise produces no results.
Note that when you are uninterested in the result of the filter and only 
use it for testing conditions, and do not want it to overwrite 
currentTiddler, you can just assign it to an unused variable like *_null*

Lastly, note that the debugging widget you have includes two separate 
widgets:
*$log* and *$action-log*

$log is renderered and run when wikitext is processed, just like any other 
wikitext.
$action-log behaves like an action widget, and is only executed when 
triggered by a button widget. 
Otherwise their parameters are identical.

So use $action-log when debugging actions performed on clicking a button or 
other actions trigger.
It will only log on executing the actions, whereas $log will log even on 
opening the tiddler with the wikitext, or when it refreshes.

-- 
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/82337294-2a33-4739-8345-9ee84b98b7b7o%40googlegroups.com.

Reply via email to