I have a Realm database with data in it. I need to fetch multiple rows from the database based on a given date. I used the following query and it does not return me the required results.
RealmResults<GenericTrait> result = realm.where(GenericTrait.class)
.equalTo("date", MainActivity.date)
.equalTo("id","Openness")
.or()
.equalTo("id","Neuroticism")
.findAll();
I need to fetch the rows for id's of Openness, Neuroticism for the given date. How should I do it. Please help.
In Realm AND is implicit while OR is explicit. So currently your query would read like this:
You can manually set beginGroup/endGroup, so your query should instead be this:
Which will give you the correct grouping: