USAMA MALIK
USAMA MALIK

Reputation: 65

Firebase Filter by Date in Xamarin forms

Image link

i want equivalent query like this for in Xamarin forms, for showing data between date range

firebase.database().ref().child("Users").orderByChild('regdate')
  .startAt("2019-01-05").endAt("2019-01-10");

or any other way to filter data by date range in xamrin forms. i am using NuGet package FirebaseDatabase.net for my app. please help me how can i achieve it?

i copy the above query from this link.

Upvotes: 1

Views: 703

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599766

The repo for the firebase-database-dotnet package contains documentation on how to query the database. From reading that, it looks like the query you found translates to:

var firebase = new FirebaseClient("https://dinosaur-facts.firebaseio.com/");
var users = await firebase
  .Child("Users")
  .OrderBy("regdate")
  .StartAt("2019-01-05")
  .EndAt("2019-01-10")
  .OnceAsync<User>();

Where User is a custom class that you create to represent the JSON properties that you store for a user in the database, similar to the Dinosaur class, Message class, and Author class in the samples in the firebase-database-dotnet repo.

Upvotes: 1

Related Questions