JSON length() as a global list?

Is there a way (or a workaround) to use a for loop generated from the formula $fl(0, 20, “i + 1”, “i”, “,”)$ where “20” is the total length() of my json, into a global list (since the output is 0,1,2,3… which is comma separated)? I used the above for loop formula in the global list dialogue, but it doesn’t seem to generate the list with the said numbers.

I’m hoping to use this for 2 touch buttons (previous button, next button)

Workaround I tried:

I tried using “20” as a $gv(items)$ then using Action: toggle global switch, switch: items, text: $gv(items)-1$ for the “previous button” and text: $gv(items)+1$ for the " next button" and display the result in a text box $gv(items)$. Buttons work fine, but when I reach “0” and once again press the “previous button, the result becomes " -1”. What I want to happen is when $gv(items)$ reaches " 0" and I tap the " previous button", the result should be " 20" same when I touch the “next button” and $gv(items)$ is " 20" or reached its max, returns to " 0".

So in essence, I just want 2 touch buttons to rotate forward or backward through the values set. Thank you so much for your help

So you want to generate a global list preference using a JSON? I have not tested it BUT you could try using a Flow and writing the list into a list global you previously created. Flows right now do not know anything about the global type so in theory it should work. Will test.

1 Like