Hey folks - I have a database with a table that has multiple boolean fields, eg Field1, Field2, Field3. Each record has some combination of TRUE or FALSE for each column, this is fixed and does not change. Example:
Record1 has Field1 = TRUE, Field2 = FALSE, Field3 = FALSE
Record2 has Field1= FALSE, Field2=TRUE, Field3 = FALSE
Screenshot of the fields for example:
I also have corresponding inputs, one for each field, that are also boolean, eg Input1, Input2, Input3. These inputs are just checkbox values from my front end. Users can check any or all of the checkboxes. Eg a user may choose Input1 = TRUE, Input2= FALSE, Input 3 = TRUE.
I want to query and return any records whose boolean columns are TRUE only if the corresponding Inputs are TRUE too. Only one Column x Input boolean combination needs to be satisfied (TRUE = TRUE) in order for the record to be included in the output. If an Input is FALSE, I don't want to evaluate it or use it in the query logic- ie, I only care about evaluating Inputs that are marked as TRUE.
For example, if a user chooses Input1 = TRUE, Input2= TRUE, Input 3 = FALSE then the output should return both Record1 and Record2.
I've spent a few hours today trying to figure this out using a combination of variables and conditions but have been unable to.
I originally tried setting up my query all records conditions with Field1 = Input1 OR Field2 = Input2 OR Field3 = Input3. However, this returns all records because many records will have fields = FALSE and their inputs will be false too.
Any help would be appreciated. Thank you!