How do I work with lists in Firebase?

Thunkable - Google Chrome 12_6_2022 6_24_48 pm


So i am experiencing a few issues.

  1. When i try to set the property in the first block, it doesnt work at all, and
    2.Since both lists and objects are saved the same way in firebase and when i set the text on labels to the objects, it also displays a list, i assume they work the same? why doesnt this work?

There is probably something small i missed, could anyone help me pls?

1 Like

It seems you saved a List under the key name. The 0 under name is an index not a property.

1 Like

Try to get property “1.1” because the first item of a list in Thunkable is 1. In Firebase, it’s labeled as “0”.

1 Like

@tatiang No that doesnt work. I tried 1.1 and 0.0 but both dont work while 3 changes the 3, not the third one

1 Like

So how would i retrieve or change it? thanks

1 Like

Sorry, I think I was mistaken. It looks like the “0”, “1” and “2” properties are not in a list. Try getting the first list item of cloud variable name and then getting the property “0” of that to get the value 1; property “1” to get the value 2; and property “2” to get the value 3.

1 Like

but how would i change those variables using the blocks in the photo?

I think you can set the property “[1].0” of object cloud variable name to 5678 (which will change the 0: 1 in your screenshot to 0: 5678).

For the get property, what are you trying to change? Are you wanting to add 3: 3456 to name[1]? If so, name[1] is not a list so I think you’d just set property “name[1].3” to 3456.

If you’re still having trouble, can you export the JSON from the Firebase console and post it here? Make sure to format it as “Preformatted text” using the </> toolbar button.

1 Like