Saq,

You have thrown the cat amongst my pidgins here. I am keen to see If I can 
use this design to generate an end of process. There were features in the 
old TWC for each tiddler macro we are yet to recover.

If you make a tested demo example of this code pattern please share.

However I realise my own recent post to Werner allows a test for 1st and 
total count (last) to trigger  beginning and end processes.

Regards
Tones

On Thursday, 27 August 2020 06:41:16 UTC+10, Saq Imtiaz wrote:
>
> I'm a bit tired so this isn't as clear as I would like, but hopefully this 
> pseudocode will point you in the correct direction for the pattern for 
> getting this done with just wikitext:
>
> \define processRow()
> nestedRows = level2 +count[]
> <$vars cnt={{{[<cnt>add<nestedRows>]}}}>
> <$list filter="[[allrows] +[after<currentTiddler>]]" 
> emptyMessage="<<cnt>>">
> <<processRow>>
> </$list>
> </$vars>
> \end
>
> \define processAllRows()
> <$vars currentTiddler={{{[allrows] + first[]}}} cnt="0">
> <<processRow>>
> </$vars>
> \end
>
> <td rowspan=<<processAllRows>> > or set it to a variable for re-use.
>
> On Wednesday, August 26, 2020 at 9:16:30 PM UTC+2 Werner wrote:
>
>> Good evening guys, me again.
>>
>> I understand that the scope of a variable is defined by the enclosing 
>> <$vars> <$set> or <$wikify> widgets. I also understand that any new <$set> 
>> widget opens up a new scope, where a variable <myVar> defined in an outer 
>> scope would be overridden. I am facing a problem where I would need to 
>> access out-of-scope variables (or come up with a completely different 
>> approach).
>>
>> I am still working on a set of double-nested JSON data (using Josh 
>> Fontany's JSONmangler plugin). I want to display the content of the data in 
>> a table using table cells spanning multiple rows like <td rowspan = "5">. 
>> The problem here is, the rowspan is defined by the number of elements in 
>> the lowest nested level and I would need it before rendering the table and 
>> looping through the array elements fetching the data. So typically, in a 
>> garden variety programming language, I would do something as follows:
>>
>> totalRows = 0
>> Loop through Level1
>>    nestedRows= Level2.count()
>>    totalRows += nestedRows
>> End Loop
>>
>> Could anybody enlighten me, if a construct like this is possible in TW 
>> and how I would achieve it?
>>
>> Two fallback options: 
>> - storing the number of elements in the JSON structure (yuck - feels like 
>> cheating).
>> - throwing the whole JSON data structure at an JS macro. Positive side 
>> effect: I would have to dive into it and learn something new.
>>
>> Thanks for helping me out on this.
>> Best, Werner
>>
>>
>>
>>
>>
>>

-- 
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/b37c8818-10e1-4e21-865c-3e83b6d28412o%40googlegroups.com.

Reply via email to