Can't seem to access items in list by index

Can you help me with why my requests for items that are position 2 and 3 in my list can't be accessed by index number? Why does it think I only have one item in the list? The formmenu can see the whole list. I'm stumped. See example below:

{names={=["345 4F - Titan", "345 4F - Gareth", "345 4F- Mary"]}}

List value:{=names}
Number of items in list: {=count(names)}

{=[names][1]}
{=[names][2]}
{=[names][3]}

{run: selected_names=names}
Name selector→{formmenu: name=selected_names; cols=40; multiple=yes; values={=names}}

Hello, welcome to the community!

The issue is caused by using the wrong syntax, you are creating a new array that contains the array you already have: [name] and then accessing it: [name][2]. What you want to do is to access the array directly: name[2].

Your code would work if you were creating the array right away, for example ["345 4F - Titan", "345 4F - Gareth", "345 4F- Mary"][2]. But since you already have the array you can access it directly.

Here's a fixed version.

{names={=["345 4F - Titan", "345 4F - Gareth", "345 4F- Mary"]}}

List value:{=names}
Number of items in list: {=count(names)}

{=names[1]}
{=names[2]}
{=names[3]}

{run: selected_names=names}
Name selector→{formmenu: name=selected_names; cols=40; multiple=yes; values={=names}}

1 Like

Ooops! Thanks so much for the help!

1 Like