Error with Lists - It is working

Hello everyone, for some reason I am getting the error below. I have multiple lists from two sources:Airtable and Firebase.

This is actually working with no errors, I have the profile picture in Airtable, I get the list and compare the user who sent the message so I can get the position of the image in the list from Airtable.

As said before it is actually working, but for some reason I am still getting the error

Blocks

generally before selecting something from a list make sure the list is long enough (i.e. for selecting the 1st item the length of the list must be minimum 1)
Taifun

The lenght of the list with the problem is actually 3

according to the error message the length is 0
btw. the index in list block returns 0 in case the “thing” has not been found in the list…
Taifun

I get your point, but if there is an error and my list is empty, my profile pictures should not be showing.
As the data has been already pre-set, I should not get 0 values.

Check where/when/how, in your workflow, global Messages is being populated. I would guess that your procedure is running once beforehand, resulting in the error.

Thanks so much for your reply. The problem is the ChatUserList. When I remove every block which contains this list, the problem disappears. I dont see any issue there… I tried with a timer, I delayed the procedure for 1sec, but nothing solved.
image

Do you think that could be a companion error? The App is working just fine!
image

Nothing to do with the companion, it is the way your blocks work. You will always call tag=Message in the gotValue event block, therefore on the first run it calls it when there is no value. You need to add an if/else once tag=Message is returned, testing if it is empty or not.

1 Like

This is very confusing, this is my procedure:
When the Screen is initialized I request Users to firebase
image

When the users are gotten I call messages and Image Messages

After that I get my Users Image and lastly my Usernames( from airtable)
image

Start the procedure to list messages

I see it now. The issue is that when the gotValue event runs first time, to get the User, it then runs the rest of your blocks, including the ListMessages procedure. At this point Messages is an empty list, when it runs the second time to get the Messages, Messages has list content so everything is OK.

Move your call Spreadsheet2.GotColumn up into the last else if, with set global imageListFirebase and see if that works. If not, you may need it somewhere else…or set another if block to test if Messages and imageListFirebase are NOT empty before calling it.

Just tried the other way around. calling first Airtable data, but the problem still persists. Also tried getting the lenght of all my lists, everything happens so fast that I dont get where is the problem

@TimAi2 Tried adding an if to make sure the procedure starts until the list is full, The app just stops… What else do you suggest?

Well that is not what I suggested :wink: Your problem was the double call in GotValue with their being no content in Messages on the first call. You need the if/else in there to test if Messages is empty (or NOT) before calling the Spreadsheet2.GetColumn-Image block

image

My problem is actually with the list called UserList, look, Trying to verify if there is data, my app just shows 0 values. I know that is because image field was not called, but at that point UserList should have values already

[Solved]
The problem were these blocks

These were getting data since the screen initialization (Not sure why as I dont change any data on initialization)

What I did is to make sure these blocks are not used until all data has been fetched.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.