Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check two fields with Realm database

Tags:

android

realm

How can I create an and operation with Realm?

Example I have an object with day and month and I want to check both those fields values.

Something like :

 RealmResults<Event> toEdit = realm.where(Event.class)
        .equalTo("day", day)
        .and
        .equalTo("month", month)
        .findAll();

But as far as I can tell there is no and operator.

Thank you

like image 375
vicolored Avatar asked Sep 08 '15 15:09

vicolored


1 Answers

Multiple conditions are combined with And unless there's an .or() between them, so it's just:

 RealmResults<Event> toEdit = realm.where(Event.class)
        .equalTo("day", day)
        .equalTo("month", month)
        .findAll();
like image 107
Thomas Goyne Avatar answered Nov 02 '22 20:11

Thomas Goyne