Adding new data to firebase with same tag

Hi, can someone give me an example of how to add data to firebase using the same tags over and over (creating new rows of data, and not just replacing the data thats already added to firebase with that Tag):

Something like this (the question would be for the 'Ids":

-UID
------email
------name
------uploads
--------------- -id (111)
--------------- -id (222)
--------------- -id (333)
------age
------height


Thanks!!

You have to make a new bucket with user id or device id and add these all in that nodes in that bucket

Hi! Thanks for the response, Ive got the bucket setup with user id and I can add to the node, the problem i have is that every time I upload data the data is changed in those tags, I need the data that is uploaded to stay and for new data fields to be added.

These are my blocks:
blocks - add firebase

This is the database:
base - add firebase

Adding stuff to an existing tag is delicate because saving using an existing tag would usually overwrite whatever was there before.

Beyond using buckets and creating new tags, what you could do is

  • extract everything that is presently stored under the tag
  • ADD the new data, or replace the component that needs updating in the currently local copy
  • save the updated record using the old tag

The issue that you need to be aware of is that you temporarily recover the whole block of data locally, and if you keep adding and appending stuff to it without ever removing anything, it may at some point get too large to manage gracefully.

you have to store data in new user id, for example if user 1 have id abc123 then set tag abc123/loans/producto, and for user 2 abc124/loans/producto, you can use join block and in first text use user id and in second use /loans/Producto

Hi guys, @ImranTariq, @CBVG thanks for the replies!!

@CBVG great to have someone with your experience in the community!

@ImranTariq I do have the UID as the project bucket, so when I add data it is only added to that user, the problem I have is the next time I add data it replaces the data added before.

I’m not sure that i’ve understood the concepts fully.

So basically the app allows for transactions, all transactions must be stored in the database, and they must be asigned to the user that made the transactions, and obviously they cannot and should not be removed or replaced by the next transaction.

How would you guys go about doing this efficiently, is there any chance you guys could show me some simple example blocks? I know it’s a lot to ask, but ive been stuck on this for over a day.

Thanks!!

1 Like

try like this, for main node add device id or user id if he login with firebase auth then get there user id, and use with firebase url as node like https://firebaseurl/userid and set bucket to loans it will create a bucket in that user idd, and store data in that,

Thanks! I’ll give it a go and let you know how it goes!

1 Like

Hi, ive tried it out, and cant seem to make it work.
I can´t set the url as a generic https://firebaseurl/userid, can I?
If I set it up as https://firebaseurl/abc123, than the next user would also save their transaction to that user and not himself.

If I set it up with device ID than if the user uses another device will his transactions disapear?

Like I said before, i am not having trouble saving data under loans for each user, the problem I have is the next time I save a something under loans it will replace the data that came before.

Any suggestion?

Thanks!!!

for every user id will change like in my given example, if we set device id, then every device has different id so for every user node a new node will created and data saved to that node

Thanks for the quick response!
I set up with my url (example): https://myapp.firebaseio.com/userid and got an error message and the app shut down.

is that format correct?

Thanks!

1 Like

this is happening because we must have to create that node before calling, we have to set user id as bucket while user login and save data in it then we can get data from that, like

firebase url : https://myapp.firebaseio.com
project bucket: userid
store data tag= email, value= user email,

when user apply for loan , then set bucket as userid/loans and store data

Hi, ive got it to work but the issue persists, every time I make a transaction it replaces the old transaction, I need every transaction to coexist with the previous ones, that is the issue i am having, any idea of how I can fix this.

base - add firebase

Thanks!
And sorry for the hassle!

1 Like

dont use user id , because every user must have different node(userid) how you will set another user?

and you can use that blocks for replacing values too, where you are replacing that values use same blocks there, get userid of that user and set that as userid/loans and store value,

user id must be different so every user has that for him self only

@ImranTariq ive set it up like this where the user id, in this case is: B3TTDyeLu9YfhZurSFzUfWocGv22

In the image in my last post both the transactions are from the same user, what I need is something like this, where all the users transactions get recorder, not replaced:

Thanks!!

you cant use 2 same tags in one node, so you must have to create another node like loan2

Ok! I understand, can you please show me a block example to do this?

Sorry I know its a hassle and you must be busy!

thanks!

send me your aia in my pm, so i will check on that, because for show you i have to create whole app again

@ImranTariq thanks a lot for the help!

I ended up doing this (it does exactly what I need it to)!!
Setting up the child as a global variable equal to a large random number.

base - add firebase

Thanks!
Regards

1 Like

thats good

1 Like