0

Can i have a query, where i have one "and" and three "or" conditions?

I tried with this one, but it has webmegjel = 2 entries in the list, so it does and or or , not and (or or). I tried to give extra parentheses for the "or"-s, didn't help me.

Store.box<Cikkek>().query(Cikkek_.webmegjel.equals(1)
.and(Cikkek_.cikknev.contains(search)
.or(Cikkek_.cikkszam.startsWith(search)
.or(Cikkek_.gyarto.contains(search)
))).build().find()

I would like to have a list where Cikkek_.webmegjel.equals(1) always true, and one of the other three conditions.

Is that possible? Or do i need to do 2 queries for this?

Ebadta
  • 317
  • 1
  • 3
  • 10
  • Parentheses should be respected, there is a test for that: https://github.com/objectbox/objectbox-dart/blob/52f57bc402602c0b779309c1978f878e44050906/objectbox/test/query_test.dart#L499-L519 Maybe add the required parentheses, or use `|` and `&` for easier to read syntax. – Uwe - ObjectBox Feb 20 '23 at 09:47

0 Answers0