General
Introduction to BrewwQL
31min
what is brewwql? we designed brewwql to help users simply and powerfully filter their data in breww with a few simple operators, you can now easily create simple or complex filters to drill down deeper and more easily into your breww data brewwql can seem daunting at first, especially if you're new to "query languages", but the doors it opens to both reporting and customisability in breww make it worth reading on! if you've built reporting using sql before, then you'll be right at home examples basic examples to best understand brewwql, it's helpful to see some simple examples let's say we wanted to see all of our customers whose delivery address was in london in the customer filter form, we would type brewwql delivery address city = "london" and that's it the autocomplete will show every option as you go, making it really straightforward to put together queries and view available options if we want to drill down deeper, we can from those customers, maybe we only want to see those whose average order value is greater than £250 for this we would chain two statements together with the and operator brewwql delivery address city = "london" and average order value > 250 perhaps we are wondering which of those customers have lapsed, as we might want to contact them about reordering so let's narrow the search for only customers who haven't ordered in the last 90 days brewwql delivery address city = "london" and average order value > 250 and last order date < "90 days ago" now let's say we are doing some admin, and we wanted to see all customers who we haven't entered a contact for yet in the customer filter box, we would type brewwql contacts = none advanced examples brewwql allows us to traverse through attributes of what we are searching through for example if we wanted to see customers who are part of a customer group with a billing address in london we would write brewwql customer group invoice address city = "london" the between customer group and invoice address city is used in brewwql as a way of traversing through attributes of attributes we can also use brackets to add more complexity to our searches brewwql (delivery address city = "london" or average order value > 250) and last order date < "90 days ago" the above statement will be analysed from left to right, and statements in brackets will be evaluated as a single attribute so the query will retrieve all customers whose delivery address city is london or who has an average order value greater than £250 only if they also have a last order date more recent than 90 days ago we can also nest brackets within brackets the below query will return either customers who are in london and are pubs, or those whose average order value is greater than £250, as long as their last order date is more recent than 90 days ago brewwql ((delivery address city = "london" and type type = "pub") or average order value > 250) and last order date < "90 days ago" using the same attribute multiple times this can be a little confusing at first each statement between operators, must be complete and be able to work on its own this means that if you're joining multiple filters together with and or or , like statement and statement , both statements must be complete on their own we'll walk through an example when looking at product filtering, you could filter the type of product to only include casks with brewwql type = "cask" or you could filter kegs only with brewwql type = "keg" now, if you wanted to include both casks and kegs, you might be tempted (and understandably so), to do this brewwql type = "cask" and "keg" however, this is incorrect on two counts the first being that each statement (each side of the and ) must be a complete statement here, the type = "cask" is perfect, but the second statement being just "keg" is meaningless on its own, and so will not work so, you can correct this to brewwql type = "cask" and type = "keg" this is much closer (and hopefully explains what's meant by each statement being a complete statement when looked at on its own) however, in this particular case, this isn't what's needed we're looking for both cask and keg products, but this will be checked against each individual product, and any single product cannot be both a cask and a keg the above is filtering on products which are both casks and kegs (which is impossible), so what we really need to check is if the product is either a cask or the product is a keg and that can be done with brewwql type = "cask" or type = "keg" success! the above would give the desired result or finding both cask products and keg products if you wanted to make this a little neater (and maybe more readable), you could instead use the in operator to check if the product's type is in the list of options given this would be done with brewwql type in ("cask", "keg") this is certainly more readable if the number of options were to increase from two to four (or even more) brewwql type in ("cask", "keg", "service", "guest beer") verses the more verbose brewwql type = "cask" or type = "keg" or type = "service" or type = "guest beer" dates brewwql allows you to filter on dates and has a powerful natural language understanding for example, if you'd like all customers who have ordered since the 1st january 2021, you can simply enter brewwql last order date > "1st january 2021" or brewwql last order date > "01/01/2021" or even brewwql last order date > "1 jan 2021" brewwql also understands relative dates, so you can filter on the last 30 days with brewwql last order date > "30 days ago" or filter on the last two months with brewwql last order date > "2 months ago" some other useful options for date filtering include the phrases brewwql last order date > "first of this month" brewwql last order date < "last of this month" brewwql last order date > "first of last month" brewwql last order date < "last of last month" brewwql last order date < "monday last week" brewwql last order date < "monday next week" brewwql last order date < "last monday" brewwql last order date < "previous monday" brewwql last order date < "next tuesday" brewwql last order date < "this wednesday" a date is greater > than another if it is more recent, and less < than another if it is older you can think of this as if someone started counting at the beginning of time the number they had counted to last week is less than the number they have counted to right now to filter on a range of dates, you can use the same field twice brewwql last order date > "first of last month" and last order date <= "last of last month" date ranges brewwql date filtering is always based on a specific date, rather than date ranges for this reason, to create a date range filter, you need to add two filters for example brewwql last order date > "01/01/2025" and last order date <= "07/01/2025" as date ranges cannot be used in a single filter, the following will not work brewwql last order date = "this week" but this will work to achieve a filter of "this week" brewwql last order date >= "this monday" and last order date <= "this sunday" case sensitivity do capitals matter in my searches? no , a search for brewwql delivery address city = "london" and brewwql delivery address city = "london" will return the same results operator reference operator meaning example verbose = equal to name = "the shop" where the name is equal to "the shop" != not equal to name != "the shop" where the name is not equal to "the shop" contains name "the" where the name contains "the" ! does not contain name ! "the" where the name does not contain "the" > greater than average order value > 100 where the average order value is greater than 100 >= greater than or equal to average order value >= 100 where the average order value is greater than or equal to 100 < less than average order value < 100 where the average order value is less than 100 <= less than or equal to average order value <= 100 where the average order value is less than or equal to 100 in in name in ("the shop", "the pub", "the restaurant") where the name is either "the shop" or "the pub" or "the restaurant" not in not in name not in ("the shop", "the pub", "the restaurant") where the name is not "the shop" and not "the pub" and not "the restaurant" how to add a date range in brewwql brewwql is a powerful function in breww that allows for filtering of data across multiple areas such as customers, sales and reporting to present precise and accurate data one feature of brewwql is the ability to set custom & dynamic date ranges in this post, as an example, we'll go over getting all customers who've ordered over 1 month ago but less than 3 months ago go to customers and click on the + add filter button in the brewwql box this will present a choice of options of filters but for this example, 'last order date' has been selected from here, you can then select the first part of your date range by entering your date (dates can be entered in the format dd/mm/yyyy (e g "29/03/2022") or as relative dates, such as "3 months ago") for the example above, we are going to enter '1 month ago' and select 'last order date is older than or equal to 1 month ago' brewwql has the ability to add multiple concurrent filters to the query this is how you would select your second date in the range for the example above, you will want to add a 'last activity date' of '3 months ago' to continue this example, select an order date of 'last order date is more recent than or equal to 3 months ago' this should give you a brewwql query string that looks like something like this brewwql last order date <= "1 month ago" and last order date >= "3 months ago" you can see the separate queries joined by the 'and' keyword if you have any questions or need help forming a query, please let us know