I am building a filtering system for a report and am trying to find a way to incorporate and/or logic when both are to be mixed.
In essence, a very simple filter might be:
Select field 1 from table where field2="123" OR field3="123"
In that scenario, I am using something like the below and it is fine:
However, occasionally users will want to mix and and or in the same query which then becomes more complex from a UI perspective. For example,
Select field 1 from table where (field2="123" OR field3="123") AND field 1="abc"
Simply using the original UI doesn't work as it does not allow the user to specify the bits which are in brackets so I need to incorporate allowing them to do that - without doing this then the query reads very differently!
My example is pretty simple but of course queries can be a lot more complex than this so you might have three groups of OR and then two ands for example in which you need to know which OR as well as maybe the ANDs to bracket and so on
What would be the best way to allow the user to do this?