Boolean logic for select query assistance

I’m trying to construct a selection criteria as follows

Select where
Type = x and WTotal <> 0
OR
Type = x and YTotal <> 0

Type should be user choice at runtime.

I have added TYPE to the Root node and created two sub nodes each containing their respective Total <> 0

I’m getting confused when to use the AND or the OR

I dont want to add the TYPE field to each sub node because if I do the runtime choice of Type is duplicated.

Hope this makes sense.

Simon, I added missing paragraph about this in KReporter documentation:
https://spicecrm.gitbooks.io/kreporter-4-x/content/basics/backend/select.html

For your report drag your field “type” into select as usual.
Group root (always there per default) has TYPE AND. This means that any field or group in root level will be concatenated with AND in where clause.

Add a group “W OR Y” (name it as you like) under root. Click OK.
Then select TYPE OR for this group. All fields dragged into this group will be concatenated with OR in where clause. Drag your fields an configure their settings (operator, value, editable…)

Thanks. That explains it and it works nicely.