Error with variable initialization: "Select list item: Attempt to get item number 2 of a list of length 1: (*empty-string*)"

Guys I have an error in the blocks but I’m not able to solve. I’m developing an app to show the user their dashboard, but this error is appearing to me: “Select list item: Attempt to get item number 2 of a list of length 1: (* empty-string *)”
It is showing the initial value of the variable instead of showing the values ​​that I am separating by the function. And I don’t know how to make it work, I need help to solve it.

blocks (2) blocks (1)

Where is the select list item block for which the error is shown? Check the list your passing in that block using ‘Do it’.

I’m sorry, I forgot to show the block, here it is, the variable list_valores ​​and valores ​​is created as empty.
The problem is.
The problem is that in the side_bar block I call the valores ​​function to do the entire listing process and show them at that moment, but it shows it empty.

Can you show us the result of “dados_all”? :thinking:

From what I see, you are setting “global lista_valores” to, basically, “dados_all”

So, at first the value is null because the variable was initialized null, but then when I click again on the page it gives me the values ​​I’m asking for, the lista_valores is taking all the dados_all values ​​and separating them by commas.

What you get is a CSV List, so why are you using the “Split at” block?

The CSV List is because im using an extension for chart and the split its because im get values ​​from a sql server.

And why don’t you just use the “List from CSV record” block? The “select item from list” block also works with this

What is a extension chart name ?

I managed to resolve the error, thanks for the help.

1 Like

https://puravidaapps.com/pie.php

1 Like