Good morning, when someone makes a purchase I am saving the data in Firebase: Product, value, code (random numbers) and user information. Now I want to create a screen to display the person’s statement, showing the purchase information but I have no idea how to do it, I don’t even know where to start, I’ll send some information below:
I need each time the user makes a purchase to create an item in a list on the statement and for this information to be saved in their registration. Maybe I’m saving the purchase the wrong way, I don’t know… I’ve tried saving purchases in the person’s own UID (usuarios) but I couldn’t.
Hello, thanks for replying, but could you give me the blocks of how I would go about adding the “compras” within “usuarios”. I think the rules are ok, I’m just getting the blocks wrong, I’d be like this:
{
"usuarios": {
"NffX8NEIaLhtYqm4lg9vnpllXHo1": {
"Compras": {
"Codigo": "222222222",
"Produto": "Take me back to the night we met - Chapter 1",
"Valor": 68.99
},
"CPF": "000.000.000-90",
"Cashback": 0,
"Celular": "51 000000000",
"Cidade": "EUA",
"Email": "luiz@admin.br",
"Estado": "California",
"Foto": "file:///data/user/0/com.thunkable.live/cache/ImagePicker/91663f37-6f7b-4810-97a4-32e8f4bc8a07.jpeg",
"Nome": "Luiz",
"Numero": "2223",
"Rua": "Christ",
"Sobrenome": "Eduardo"
}
}
}
In case you don’t understand, I want to add the “compras” inside the user’s UID (Those random letters).
I don’t think I understand your question, but I want it to be executed when a command is executed I want it to store a value with a random code inside the user’s UID, thus saving the information of a purchase. So, later, I want to create a shopping list by pulling the user’s data and taking their purchases to put on a list.
Sorry, I got confused between @ioannis explaining how to get values from Firebase and your question about how to save values to Firebase. To save a value, you would do something like this:
set cloud variable usuarios/NffX8NEIaLhtYqm4lg9vnpllXHo1/Compras/Codigo to “222222222” or you can set the whole object at /usuarios/NffX8NEIaLhtYqm4lg9vnpllXHo1 with many different values by creating an object to replace the one that’s there.