How can i select a specific user in firebase with subdirectory and add a new value

Hey, guys, I need your help.
I’m working on a little project.
when a user registers a user id is created in firebase with a subdirectory.

for example
mIfcvvI912141yfXZJQSVMevl2
test: “15”
points: "“5"”

mIfcvvI912141yfXZJQSVMevl2
test: “18”
points: "“50"”

and when he clicks on a button he gets a point.
I’m stuck here.
the same concept as app earning
as you can see from my beginner’s level, I thought I’d have this

so I can specify the current user but I don’t know how to add the value of 1 + its old value to it.
if I use the got value block I can add the value 1 + the old one but I can’t specify the user

so how can i select a specific user in firebase with subdirectory and add a new value + keep the old value

thaks.

1 Like

No earning apps please @haiken

no it’s not an earning application but there will be a screen with the same concept for a specific period of time.

1 Like

if you something that looks like an earning app could do your app will never be approved for serving ads.

Ok… I got it… Now tell me clearly what you actually want to do… @haiken

To save a value inside a user id, you must set the Project Bucket to the value of the user id:

ProjectBucket

And then you save the point value

1 Like

Okay,
for example there are 2 users each has a “test” folder.

user 1
mIfcvvI912141yfXZJQSVMevl2
test: “15”

user 2
mIfcvvI912141yfXZJQSVMevl2
test: “18”

when the user clicks on a button a value of 1 will be added to the test sub-folder

but my problem is during tests when both users click on the button only one test tag is created and takes the value 1,
I want that each time a user Click the value 1 will be added in the test subfolder, according to my little experience with kodular I have to select the current user automatically and give him the value but I don’t know how to do that, if I use the “current user block” I can’t add the value 1 to the old value and if I use the “got valut block” I can’t select the current user

I hope I was clear

hi
I want it to happen automatically when the user clicks on a button.
for example when user 1 and 2 or 3 clicks a value will be added

Hi
I know I use the term earning app just to be clear, my app is a project that must store a value locally and on the web for each user who uses it.
“Like points of loyalty”

Then you can do what I tell you. adjust the project bucket well and you’re done

@pepocero
no I think my answer was not very clear because I use a google translation so I’ll try to explain it well.
the goal of my project is
if 10 users register each will have a user ID in farebase
then supposing that 4 users have clicked on the button to get 1 point each of the 4 will have a point the others will not.
I’m far away I don’t manage this and normally I don’t know who clicked or didn’t click all that I can see in the firebase that there are 4 users who have 1 point each.

with your method it won’t work because I need to have the use ID of that user and give them the value 1 but it’s not me who decides who should take a point it’s the user.

I’m stuck here when I do my tests with user IDs a new folder is created in the firebase as if it was a new user that takes the value 1 and when I click on the button of different phones it’s always this folder that takes the value and I can’t send the point to the user who clicked on it.

ffffure

Hi friends
I spent all afternoon thinking of a logical solution and after several tests I found a solution I will share it with you. Maybe someone will have the same problem as me.

That’s how it works.
when the user registers his user Id is registered in Tiny DB and firebase.
when the user click on the button he calls firebase and to specify the tag from where the information must come I use the value stored in Tiny DB which is the user ID so I can specify the exact destination of the value.
so each user will have his own value in the exact folder

I thank everyone who tried to help me. Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.