I have the following realm query but from reading the documentation I don't see a possibility to do an IN query.
I need to search for an id in a string or array containing that id. Is this possible?
Example code:
Realm realmThread = Realm.getInstance(visnetawrap.appModel);
RealmResults<PropertyObject> propResults = realmThread.where(PropertyObject.class).contains("propertyID", "(5,7,10)").findAll();
I'm afraid I am pointing out the obvious, but you can chain or
ed equalTo
s.
RealmQuery<PropertyObject> query = realm.where(PropertyObject.class);
query.beginGroup();
for(int i = 0; i < propertyIDs.length - 1; i++) {
query.equalTo("propertyID", propertyIDs[i]).or();
}
query.equalTo("propertyID", propertyIDs[propertyIDs.length - 1]).endGroup();
RealmResults<PropertyObject> propResults = query.findAll();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With