How to increment a variable in a list

27 views
Skip to first unread message

vpl

unread,
Oct 16, 2021, 2:03:11 PM10/16/21
to TiddlyWiki
Hi,

I'm blocking on how to increment a counter into a list
I have the following code which display a list of checkbox

I need to set the index in the DataTiddler but in the below example the <<vals_rep>> remains to  ..
Anyone who has an idea why it's not working ?

Thanks for your help
Regards

<$list filter="[enlist<projs_list>]" variable ="proj_name_val">
<$vars  vals_rep ={{{ [<vals_rep >add[1]]       }}}>
<<vals_rep>>
<li> <<proj_name_val>> <$checkbox tiddler="projs_selection" index=<<vals_rep>>  checked=<<proj_name_val>>>  </$checkbox></li>

Mark S.

unread,
Oct 16, 2021, 2:19:35 PM10/16/21
to TiddlyWiki
I don't believe that you can increment a variable that way. You might be able to using some sort of recursive function.

But if you're using 5.2.0, you now have the counter attribute, so don't need those extra steps:

<$vars projs_list="A B C">
<$list filter="[enlist<projs_list>]" variable ="proj_name_val" counter="vals_rep" >
<li> <<proj_name_val>> <$checkbox tiddler="projs_selection" index=<<vals_rep>>  checked=<<proj_name_val>>>  </$checkbox></li>
</$list>
</$vars>

vpl

unread,
Oct 16, 2021, 2:40:26 PM10/16/21
to TiddlyWiki
as always ... just magic ! 

Thanks a lot !

Vpl
Reply all
Reply to author
Forward
0 new messages