Realtime DB - new child (project bucket)

Hi,

i hope that someone give me advice about save data in new child in Realtime DB. This settings everytime override data in db and im not able to find a way how to create new child (as is a project bucket).

Could someone share image about settings to create new child everytime when i save data? I found couple of images about this kind of settings, and i propably miss datachanged block, but i really dont know how to setup :frowning:

Thanks guys!


obrazek

Hi,

If the database contains the same type of data, then a list should be used. You add the child to the list and save it to the desired root node. To add a new child, you must obtain a list from the database, add a new child to it, and write this list in the desired root node.

Hello @Jakub_Vanek

According to your screen shorts, partner is the child name and you are storing some data ( like email, gdpr, ico . . . ) on it. And you don’t want to overwrite this. that means you want to create an another child ( e.g. partner2 ) to store another data ( like email, gdpr, ico . . . ) on it.

Am i right ?? :roll_eyes:

Hi @cttricks , your are absolutely correct. I want to save new partner2, partner3 etc… , but im not able to figure out.

Ahoj, kukam že mi budeš rozumieť tak to dám po našom, ak som dobre pochopil tak samotný text “partner” užívateľ nezadáva, v tom prípade asi stačí vytvoriť novú premennú, ktorá sa bude zvyšovať každým novým zadaným partnerom.

CZ: Ještě jednou díky moc!!! Bylo to o proměné - jakmile je nastavená, tak vždy vznikne nový zápis. Super :wink: vše funguje!

EN: You have to use variables as a value to get new child in root tree in realtime DB. Then you will create new record for each value.

obrazek
obrazek

Tak asi ne vždy :frowning:

Objevil jsem problém se zápisem do databáze z proměné, která se však zobrazuje a ukazuje v pořádku. Když to popíšu: z Local Storage si vyvolám ns nové stránce email (je to po přihlášení přes Sign-in), který je naprosto v pořádku - pokud ho vyvolám v labelu tak se zobrazí. Pokud mu nastavím hodnotu jako proměnou tak ji však nedokáže propsat až do databáze. Zkoušel jsem i variantu s přepsáním labelu jako proměné do databáze, ale to také nejde (zobrazí jen label). Co je však zajímavé, že pokud dám proměnou do create objects - tak se zobrazí v databázi správně.

Pokud přidám jako value proměnou + 1 tak se mi v databází zobrazí null - případně NaN.

Přikládám:

  1. Varianta přes label
    obrazek
    obrazek

  2. Varianta přes proměnou
    obrazek
    obrazek

Díky za případné info.

EN: I just looking for solution how to use variables in key for realtime db from local storage key. There is always data from local storage (i test it by label), but im not able to write this data as a key into database. When i use variable in realtimeDB.value its working fine, but when im use it as a key im not able to see this variable in my db.

Jakub,

If I understand your examples correctly, I believe that the problem is that the variable that you are setting from your 'Local_Storage1 call Get' block (for example, email) is not available in your call to the 'Realitime_DB1 call Save' block. To make it available you need to put the 'Realitime_DB1 call Save' block in the 'then do' slot of the 'Local_Storage1 call Get' block. In essence, everything that you want to do after you get the value of a 'Local_Storage1 call Get' block must be within its 'then do' slot.

Hope this helps!

-Mark

hi @Mark - i allready try maybe every possible way (and logic combination :slight_smile: ), but do you mean like this? Value is stil empty and dont write anything to realtime db.

For explanation - i would like to have possibility to save xx forms into realtime db base on email (every client login via email) andd then i will create next steps. For me is ideal tree in realtime db.
db/email_of_user/company1/name, phone…
db/email_of_user/company2/name, phone…

obrazek

I tried this solution - first click on button 3 to load data from local storage, then fill imput and click button 2 to send… nothing

Just for sure that email (from login user) is really available i load data into label and then send as a key… but no way :smiley:

Anyway thanks for helping :wink: im really exciting how to solve this… im looking for solution during all day

Jakub,

Another issue might be that you are using an email address as part of your key in the realtime db. A period/dot (i.e. ‘.’) is not allowed in Firebase (i.e. Realtime DB component) keys and in all likelihood your email addresses contain periods.

Just so you know, the other disallowed characters are: ‘#’, ‘$’, ‘[’ and ‘]’. We need to do a better job of documenting this limitation,

-Mark

@Mark thanks for explanation! I will try it setup blocks without these special characters tomorrow and then close this topic with solution (i hope :wink: )

Have a nice day

Hi @Mark , you are absolutely correct - there is no possibility to save data value with special characters. I have to use userid from Signin to get correct value for realtime db.

Save to local storage as value:
obrazek

And then load value:
obrazek