Help need to fix an issue with a custom dynamic table

I have been experimenting with a custom dynamic table which can be seen here - My TiddlyWiki — a non-linear personal web notebook

There is an option to add multiple steps in the filter used to create the dynamic table.
I am using select widget to add operators and parameters for each filter steps. Whenever I am making some changes in filters steps, I use an update button to apply these changes to the final filter (whose value is stored in a field called tbl-filter-value)

Currently I am manually adding update buttons for each level in the filter steps. I am defining variables for each level of these filter runs using let widget like filter1 if the number of filer steps is 1, filter2 if the number of filer steps is 2 and so on.

<$let 
tbl-filter-steps-number={{!!row-number}}
op-1={{!!op-1-value}} 
param-1={{!!param-1-value}} 
op-2={{!!op-2-value}} 
param-2={{!!param-2-value}}
filter1=`[$(op-1)$[$(param-1)$]search:$(tbl-search-field-list-join)$:$(tbl-search-flag-list-join)$[$(tbl-search-param)$]limit[$(tid-limit)$]]`
filter2=`[$(op-1)$[$(param-1)$]$(op-2)$[$(param-2)$]search:$(tbl-search-field-list-join)$:$(tbl-search-flag-list-join)$[$(tbl-search-param)$]limit[$(tid-limit)$]]`
>

In the update button, action setfield widget is used to apply the filter stored in the variables filter1, filter2 etc into a field called tbl-filter-value and this value is used to create the dynamic table.

<$list filter="[<currentTiddler>row-number[1]]">
<$button>
<$action-setfield $tiddler=<<currentTiddler>> tbl-filter-value=<<filter1>> $timestamp="no"/>
Update
</$button>
</$list>
<$list filter="[<currentTiddler>row-number[2]]">
<$button>
<$action-setfield $tiddler=<<currentTiddler>> tbl-filter-value=<<filter2>> $timestamp="no"/>
Update
</$button>
</$list>

What I want to do is to make the update button dynamic- that is to make it dynamically change the filter1, filter2 depending on the number of filter steps (which stored in a field called row number).

<$list filter="[<currentTiddler>row-number<tbl-filter-steps-number>]">
<$button>
<$action-setfield $tiddler=<<currentTiddler>> tbl-filter-value=??????   $timestamp="no"/>
Update
</$button>
</$list>

I tried many combinations, but I am not getting how to dynamcically change tbl-filter-value in the setfield widget for the update button. Can someone help, I am lost for ideas.

Dynamic table is defined here

filter1=`[$(op-1)$[$(param-1)$]search:$(tbl-search-field-list-join)$:$(tbl-search-flag-list-join)$[$(tbl-search-param)$]limit[$(tid-limit)$]]`
filter2=`[$(op-1)$[$(param-1)$]$(op-2)$[$(param-2)$]search:$(tbl-search-field-list-join)$:$(tbl-search-flag-list-join)$[$(tbl-search-param)$]limit[$(tid-limit)$]]`

Another doubt- instead of setting variables filter1, filter2 separately, can I do it using a single variable.
That is, if the row-number is 1 , use

`[$(op-1)$[$(param-1)$]search:$(tbl-search-field-list-join)$:$(tbl-search-flag-list-join)$[$(tbl-search-param)$]limit[$(tid-limit)$]]`

If row-number is 2, automaticalay append $(op-2)$[$(param-2)$] to the first filter and so on.
Is it possible ?

I have not looked in detail at your code, but is the issue is you want to transfer a selected filter string as a value into tbl-filter-value?

If The filter also needs some evaluation before its saved, and subsequently used to generate a table, you need to construct a “filter string”, that you then assign to the field value.

The issue with wikification can become important, and clumsy. My recommendation would be to use a /function and possibly the substitute operator, to construct the filter string. You may need to “join[]” the result together, then you can use the function name to assign it to the field tbl-filter-value=<<function-that-creates-filter-string>>.

1 Like

I am afraid I am not able to make it working. Hope someone can help. I have been working on this dynamic table concept for a few weeks now. It works well. But I am trying to make the code much cleaner. It’s fine if its is difficult to find a solution to this.