Rasheed
Rasheed

Reputation: 1

Query for one or more list of values to get objects with a field that is a list of values CQEngine

I am using QueryCache (CQEngine) to store a list of Alarms in memory. The alarm object has a ID, and Zones fields. The indexed field is ID, and the zones is list of strings with the name of the zone where the alarm occurred. I am trying to compare that list of zones with the user's accessible list of zones. example: I am user who has access to z1, z2 and z3, I want all the alarms that have either one of z1, z2, z3 in their zones field, so alarm1(1234,zones[z4,z5]) is excluded while alarm1(1234,zones[z1,z5]) is included. currently for another object, I am successfully able to get a string in a list field, but not a list of strings in a list of strings. Any ideas?

Upvotes: 0

Views: 141

Answers (1)

npgall
npgall

Reputation: 3028

The in() query should do what you want. Allow you to retrieve a list of Alarms, where the zone is in a list included in the in() query. You need to ensure that you are using a multi-value attribute for your zone field as well.

Upvotes: 0

Related Questions