Hi Team,
We have an List of Entities
List<UserStores> userStores = this.getUserStores();
We need to convert this to an List of strings to use in our CQL.in predicate in our where clause. I need to get the storeCode from each entity and assign to our List, then use in where clause
Basically we want to say WHERE store in('100', '101', '102') etc.
CqnSelect copy = CQL.copy(query, new Modifier() {
@Override
public Predicate where(Predicate where) {
CqnElementRef store = CQL.get("store");
CqnPredicate filter;
filter = CQL.in(store, myStores);
return where.and(filter);
}
});
This is the signature of the CQL.in method
/**
* Creates an in predicate.
*
* @param lhs the value to be checked if it's contained in the collection
* @param values the collection of values
* @return the in predicate
*/
static Predicate in(CqnValue lhs, Collection<? extends CqnValue> values) {
return CDS.QL.create.in(lhs, values);
}
How do we convert the userStores list to myStores to be able to use in CQL.in. ???
Appreciate your help