Hello, im looking for some advice,
my App data structure looks like this:
1 Project
Up to 4 Subprojects
each Subproject can have up to 10 categories
The Textinput input fields are all generated through cloning and the data is stored inside dynamic app variables.
If i want to save the values from these dynamic generated app variables into the local database i have to creat + 500 blocks.
Just because local db don’t allow to use dynamic input fields like the variables, my idea was also to use objects, but here aswell i cant generate dynamic objects. (Right?)
I could generate stored dynamic variables, but jow do i delete these variables i if delete the whole project?
Or shouldn’t i care about the left over Data?
Hierarchical data like you are describing is the strength of JSON objects. You can save the entire hierarchy you are describing as a single stored or cloud variable.
If i don’t want to use firebase than there is no better way for me to save data?
I don’t want to use Firebase because the free service is limited, in case the Data Volume exceed the free plans limit the app is not useable anymore.
And Switching to the pay as you go plan will make pricecalculation for an app you want to publish as an paid app difficult.
I understand the concern, I am also mindful of scaleability. With 10GB of free storage, that is 5 billion characters. That should easily yield millions of “rows”. Firebase’s free Spark account can also handle 100 concurrent user. I shudder to think how a google sheet will perform with 100 users all attempting to read and update a million row sheet.
But to you question of alternatives, you can use JSON without using firebase. Just save the object hierarchy in a stored variable. No firebase required.
In firebase it is fairly straight forward. But if you are just using app or stored thunkable variables it gets tricky updating deeply nested values (especially lists).
Check out my custom GET and SET functions to updated nested properties, they will make your code a lot easier to read, debug, and maintain.
Back to your specific question of updating a list that is deeply nested, the general approach I use (when not using firebase):
Set a temporary variable to the JSON node containing the target list
add a entry to the temporary variable list
Set the JSON node to the temporary variable.
Kind of a pain…
In firebase, you can set a stored variable to the node and simply add items to the variable.