Hubdb complex queries using AND and OR logic combined

Let’s say I have a table with columns: category, material, state, building type. And I want to use complex query logic by combining AND and OR, for example:

all rows where category=residential AND (material = clay OR material = asphalt) AND (state = IL) AND (building type = maintenence OR building type = storm)

How would I go about doing this with Hubl? Is this possible? I have looked through the hubdb documentation and also the api documentation and I didn’t find anything about complex logic.

Hey @CMcNamee

Welcome to the Community!

This is right up the alley of @alyssamwilie and @Gonzalo !

Maybe they can help out!

@CMcNamee If you’re using multiselect columns for the ones you want to do an OR query on you can use the __in expression and a comma to separate the options you want to check against.

{% set rows = hubdb_table_rows(XXXXXX, '&category__eq=residential&state=IL&material__in=clay,asphalt&building_type__in=maintenence,storm') %}