Hi,
I’ve been struggling from some time and decided that without help I’m not gonna jump over this obstacle.
The question is how to create a list form arrays in firebase database.
I have a structure like in the image below:
You have to create the list in a list. It requires simple logic. The easiest way to do this is to iterate trough every tag in your bucket, and for every tag if it’s a list iterate again. If u don’t want to create a lot of loops you can use “list by walking key path” and make an additional variable which is list which holds your list level so two loops with break conditions should be enough.
The easiest way to store that kind of lists is:
tag 1) TinyDB: key: “SKŁADNIKI”; value: [N, O, P W]
tag 2) TinyDB: key: “W”; value: [W_DYN, W_LIS…, W_WIE]
tag 3) TinyDB: key: “W_DYN” value: “your value”
So every tindyDB tag stores the name of a list and its content.
If u call TinyDB tag with the name of SKŁADNIKI you get list, which every item in that list is stored in tinyDB tags.
If u don’t want to use any database system and only variable is in your interest it would get harder cause if u want to hold list name you have to make additional list in a list.
Hi,
first of all thank you for answer.
The thing is that the structure of the DB will grow and I would like to set the app in such way that I don’t need to make a correction each time the new record appears.
So the problem is not in the logic, I agree that it is simple it is in the technical way to extract a list from array in JASON.
Right now I get parsing error: