0

So I have a query that I use for FirebaseAnimatedList Query query = ref.orderByChild("userid").equalTo(user.uid); It gives me a list filter by what I wanted. But how do I filtered from the query based on what I input? Basically, how do I allow it to have a multi filter?

Daniel Mana
  • 9,451
  • 13
  • 29
  • 41
  • Firebase Database queries can only order/filter on a single property. In many cases it is possible to combine the values you want to filter on into a single (synthetic) property. For an example of this and other approaches, see my answer here: http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase – Frank van Puffelen Mar 20 '18 at 16:54
  • how about you use `if` statement to filter based on your input? – grepLines Mar 21 '18 at 01:34
  • Somehow i wish they implement a function for multi filter – Daniel Mana Mar 21 '18 at 05:53

1 Answers1

0

The "multi filter" query that you're looking for in Firebase Realtime Database is one of its limitations, but there's a workaround for this as mentioned by Puf in the comments. If you're just starting out, it's worth looking into Cloud Firestore as it can handle advanced queries better.

Omatt
  • 8,564
  • 2
  • 42
  • 144