Count object properties

firebase

#1

In my Firebase Realtime Database I have a key with properties named 0, 1, 2…and so. Could I count the properties in this key in order to add a new one and name it after the sequence. For example if the last property is 4 the new one would be 5.

I can retrieve the object in a JSON format but them it show in the JSON format and i’m unable to count the properties or show all the record with the same property.


#2

Here you can go in two ways: create a structure in firebase as an array of objects with indices 0,1,2 … and then work with it as a list of objects or how do you use embedded objects, which can be converted to JSON string and manually get the necessary substrings using blocks for working with text and a list.


#3

I think you posted an example of that logic in another post, I’ll find it and give it a shot


#4

An example of manual work with JSON can be found on the scrJSON screen in the project:

https://x.thunkable.com/projects/5cd84f23e3097f3353fdad45/project/properties/designer/