Hunt
Hunt

Reputation: 8435

IN operation in realm

I have a total three classes to manage dealer's selected products data.

Classes that extends RealmObject

1) Dealers  
     DealerId 
     DealerName

2) Products
     ProductId
     ProductName
3) DealerProduct ( contains the mapping between Dealers's selected product )
    DealerId
    ProudctId

now i want to fire a query using realm

 select * from Products where productId IN ('P101','P102');

is there way to fire a IN operation in realm

Upvotes: 0

Views: 167

Answers (1)

beeender
beeender

Reputation: 3575

You can use RealmQuery.or()

RealmResults<Products> products = realm.where(Products.class)
            .equalTo("productId", "P101")
            .or().equalTo("productId", "P102")
            .findAll();

Upvotes: 1

Related Questions