Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get data based on value from firebase database

i'm trying to get the data based on "Payments" in child "State" in my structured data My Structured firebase

I used this

salesRef = FirebaseDatabase.getInstance().getReference()
                .child("Orders")
                .orderByKey().startAt("Payments").endAt("Payments"+"\uf8ff");

but i got nothing back.What was wrong ? What should i use?

like image 352
Fajar Syairillah Avatar asked Jun 11 '26 07:06

Fajar Syairillah


1 Answers

You need to do the following:

salesRef = FirebaseDatabase.getInstance().getReference().child("Orders").orderByChild("state").equalTo("Waiting Payments Config");

orderByChild will take the name of an attribute as an argument and, equalTo will take the value of that attribute as an argument.

Check the docs:

https://firebase.google.com/docs/database/android/lists-of-data

like image 78
Peter Haddad Avatar answered Jun 13 '26 20:06

Peter Haddad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!