I am trying to set the values ( one
, two
, three
in this example) of a multi-valued parameter called tbl_fields
of a procedure called dy-tbl
into separate tiddler fields like tbl-field-1
, tbl-field-2
, tbl-field-3
and so on using a button.
That is one
in tbl-field-1
, two
in tbl-field-2
, three
in tbl-field-3
and so on.
Below given is the code I tried. But only one of the value of this multi-valued parameter is getting added to all the fields using this button.
I am getting three
as value in all fields tbl-field-1
, tbl-field-2
, tbl-field-3
I want to add each of the sequential values of that parameter into separate fields sequentially in the same order as the parameter values.
Can some one help . This is part of my my solution to avoid double storage as mentioned in this post - Replace certain values in list field using edit text and action widgets - #10 by pmario
Here is the demo wiki for testing my code
\procedure append-parameters-to-fields()
<$list filter="[<tbl_fields>enlist-input[]]" variable="tbl_field_value">
<$let
tbl_column_count_number={{{ [<tbl_fields>enlist-input[]count[]] }}}
>
<$list filter="[range[1],<tbl_column_count_number>]" variable="tbl_column_count" >
<$let
tbl-fields-name={{{ [[tbl-field-]addsuffix<tbl_column_count>] }}}
>
<$action-setfield $tiddler=<<currentTiddler>> $field=<<tbl-fields-name>> $value=<<tbl_field_value>> $timestamp="no"/>
</$let>
</$list>
</$let>
</$list>
\end
\procedure dy-tbl(tbl_fields)
<$button tooltip="append-parameters-to-fields" actions=<<append-parameters-to-fields>> >
Append parameters to fields
</$button>
\end
<<dy-tbl tbl_fields:"one two three">>