Select list item: Attempt to get item number 1 of a list of length 0: []

Hi Everyone,
I was desging an app which contains a list made using dynamic components by @yusufcihan.
I got this Error when I tested it.

Select list item: Attempt to get item number 1 of a list of length 0:
Note: You will not see another error reported for 5 seconds.

I know this error means that I am trying to select item of list 1 of empty but I have items.

Blocks

I am using Firebase to get values I know it is experimental but it has worked in many of my projects and this issue is about Lists.

Even if you notice in my blocks I have set 3 Labels to be the 3 tags which shows all equal in Companion.

Also it occurs mostly when Screen is Initialized and the items get duplicated 3 times.
When I again add to Firebase, All the duplicate items are vanished.

Data Structure in Firebase

Can anyone Help me to solve this Issue!

I think the issue is the multithread nature of the requests. In your Button1.Click handler you initiate three updates to Firebase, but these can technically happen in any order. What might be happening is the update to the Date tag happens before the others and so now your Date list is of length 1 but the other lists haven't been updated yet and are therefore still length 0. You might want to try updating your code so that you loop from 1 to min(length Image, length Name, length Date). This would ensure you only ever use as much data as in the shortest list. Once all three tags have been updated they will be in sync and the loop will run.

1 Like

@ewpatton Thanks for your reply,

But How can I update all the three at the same time or How to ensure that all are updated?
Additionally the Error only occurs when Screen Initialize block is raised in which items are duplicated but the Data Change event handler is working Good .
What may be the reason?