Select list item: Attempt to get item number 3 of a list of length 1: (*empty-string*)

Good evening everyone, I state that before writing this post I searched on the various forums and Youtube, I found something but still I could not understand how to solve my problem:
I have a small database on Google Sheet, when I execute a Query to search for a data, if the data exists in the sheet, everything is ok, if instead the data is not in the sheet it gives error ("Select list item: Attempt to get item number 3 of a list of length 1: (* empty-string *)
Note: You will not see another error reported for 5 seconds. ")
I tried with an “IF” control, example: (If Global User_one = TextBox1, then go …, Else Notifier.show.alert blablabla),
Is there anyone who can help me?
I attach a screenshot
Sorry for my English

Did You check Response Content ?

1 Like

If you get EMPTY LIST as the response, and your first block is select item number 3 in list “response Content” which is empty or doesn’t exist, you get the error. You have to check at start in Got Text block if response Content is a list or its length.

Hi Rogerio, yes I checked the answer, in fact I temporarily put a label (which you see on the deactivated photo), which indicates the result of the query here it is an example of the Response Content: (xxxx @ libero.it, CCCCCC, c41c95da-412a -4345-80d4-8fa7f499f284, Nik) mail, text, playerId, Nikname

In the posted blocks:

Hi HeyAveHey,
this is the response of the Response Content, [email protected],CCCCCC,c41c95da-412a-4345-80d4-8fa7f499f284,Nik (mail,text,playerId,Nikname) so I think it’s a list

1 Like

Friend, when the Response Content is filled
([email protected],CCCCCC,c41c95da-412a-4345-80d4-8fa7f499f284,Nik) does an error happen?

1 Like

Hi Rogerio, I understand that the problem comes from (Response Content / 3) but I don’t understand how to solve. I had tried like the block I am attaching now, but it always gives error

Does an error happen ?

This is the mistake …

You should debug :
Split block result…

This post was flagged by the community and is temporarily hidden.

sorry I was replying to Rogerio

Build in a check to make sure that there are enough items in the list.

Something like
If index # is <= length of list
then select it
else do something else (notification that the data is missing)

Heck, every time I need to get data from a list I make sure it’s a list first.

1 Like

Sorry I don’t know how to debug

Check This block’s resulr before block Select item

“Do It”

2 Likes

I would also put that into a variable so that I could check that it came in as a list and that there are enough items in that list to not cause an error… But, that would just me being overly cautious and trying to build in checks for possible errors. My code for most things are full of nested if statements checking for the ways my code could break.

Right click on any of your block and click on “Do It”.
See tip 4 here

2 Likes

Hi, I tried to see before the element selection block (as per screen shoot) if I insert the right value in the TextBox that is in google sheet the result is ([email protected], CCCCCC, c41c95da-412a-4345-80d4- 8fa7f499f284, Nik) ((mail, text, playerId, Nikname)), if instead I put a wrong value the result is: (). In my opinion the problem could lie in the function

Is This your Response Content ?
Or This

([email protected], CCCCCC, c41c95da-412a-4345-80d4- 8fa7f499f284, Nik)

Read:

1 Like