Your first $list widget is resetting the current tiddler, so in your second 
$list widget the all[current] doesn't mean the same thing as it did in the 
first. If I'm understanding your tiddler layout correctly, I think you 
should be closing the first $list widget prior to starting the second one.

As for a better way, the kin filter 
<https://bimlas.gitlab.io/tw5-kin-filter/> can be used to merge all the 
levels of a multi-level hierarchy into a single list, which would prevent 
you from having to try to make this recursive to handle an arbitrary number 
of levels. I think you should be able to get that to work here.

(Also, pretty sure you need a $button widget somewhere if you want to 
trigger anything, unless I'm missing something – but maybe you just left 
that out for brevity.)

On Sunday, February 28, 2021 at 3:45:26 PM UTC-6 psigu...@gmail.com wrote:

> Oops, I missed the closing </$set> in both code fragments but that is not 
> the issue.
>
> On Sunday, February 28, 2021 at 10:27:45 PM UTC+1 Pall Sigurdsson wrote:
>
>> Hello,
>>
>> This is my first post here. I discovered TiddlyWiki last November and got 
>> hooked by its power and beauty. I challenging myself into programming 
>> something which was supposed to be very simple in the beginning but who 
>> knew that this would become so addictive? Anyhow, I have a question I'm 
>> hoping someone here could help me with.
>>
>> How can one loop through tiddlers which are two levels downstream in the 
>> tag-hierarchy or further? I already figure out how to copy a field value 
>> from the current tiddler to all tiddlers which are tagging it and which 
>> also have the tag 'task' but what I think I need help with is to propagate 
>> the value 2-3 levels further.
>>
>> The following code fragment reads the task_visibility (custom) field of 
>> the current tiddler and applies it to the next level below (only to 
>> tiddlers which are also tagged with 'task').
>>
>> <$set name="taskVisibilityValue" value={{!!task_visibility}}>
>> <$list filter="[tag[task]tag<currentTiddler>]">
>> <$action-setfield $field="task_visibility" $value=<<taskVisibilityValue>> 
>> >
>> </$list>
>>
>> Note: The filter above can be replaced with 
>> "[all[current]tagging[]tag[task]]" - it works just the same.
>>
>> One of the things I tried for taking this one level further down the task 
>> hierarchy was nesting the lists:
>>
>> <$set name="taskVisibilityValue" value={{!!task_visibility}}>
>> <$list filter="[all[current]tagging[]tag[task]]">
>> <$action-setfield $field="task_visibility" $value=<<taskVisibilityValue>> 
>> >
>> <$list filter="[all[current]tagging[]tagging[]tag[task]]">
>> <$action-setfield $field="task_visibility" $value=<<taskVisibilityValue>> 
>> >
>> </$list>
>> </$list>
>>
>> This code still works only on the first level below the current tiddler. 
>> Does anyone know how to apply this to the next level below the first child 
>> level (and further)?
>>
>> I'm also wondering whether it is a good idea to do this (or how far down 
>> to go), whether there are performance issues to be expected with a loop 
>> like this, when the hierarchy below the current tiddler might contain 
>> dozens of tiddlers.
>>
>> Best regards,
>> Pall
>> - Currently on version 5.1.23
>
>

-- 
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/313cc9b8-f488-41a8-917f-5a716bbf310cn%40googlegroups.com.

Reply via email to