Beta API Changes to filter listeners in dashboards in Looker 5.18

api
dashboards
(Alex K) #1

If you’ve been using the beta API endpoints for dashboards with filters, some changes in Looker 5.18 may affect you and your code.

If you do not update your API dashboard endpoints in Looker 5.18, your dashboards may display the wrong data, since dashboard filters won’t work correctly. Additionally, you may get errors if your process doesn’t handle a filterables array as described below.

In Looker 5.18, we have updated the format used to specify which dashboard filters a dashboard tile (element) listens to. With these updates, Looker now supports filters for dashboard tiles with merged results queries.

To illustrate the changes, here’s an example from Looker 5.16, where dashboard elements supported the listen property. The listen property indicated which filters the tile should listen to and apply to its query. This example dashboard has two filters and two dashboard elements that listen to the filters. The dashboard elements here are not merged results queries.

dashboard:
  dashboard_filters: [{
    name: "state",
    ...
  }, {
    name: "age",
    ...
  }],
  dashboard_elements: [{
    listen: {
      age: "users.age",
      state: "orders.state"
    }
  }, {
    listen: {
      state: "users.state"
    }
  }]

As shown above, in Looker 5.16 the listen property used key/value pairs, for example age: "users.age".

Starting in Looker 5.18, the structure and the location of the listen property has changed. We now use a result_maker.filterables[0].listen property instead. With the result_maker.filterables[0].listen property, you need to look at each item in the new listen array which will be an object with a dashboard_filter_name and a field in it. This example uses the new 5.18 format to create the same filtering behavior as in the 5.16 example above:

dashboard:
  dashboard_filters: [{
    name: "state",
    ...
  }, {
    name: "age",
    ...
  }],
  dashboard_elements: [{
    result_maker: {
      filterables: [{
        listen: [
          {dashboard_filter_name: "age", field: "users.age"},
          {dashboard_filter_name: "state", field: "orders.state"}
        ]
      }]
    }
  }, {
    result_maker: {
      filterables: [{
        listen: [
          {dashboard_filter_name: "state", field: "users.state"}
        ]
    }
  }]

As you can see the listeners property from 5.16 is replaced in 5.18 with a filterables property. The filterables property handles more use cases, such as multiple filters, which is required for the multiple queries in a merged results query. If you have dashboard tiles with merged results queries, you will want to look at all the members of the element.result_maker.filterables array.

0 Likes

RETIRED: Changes in Beta API for Dashboard Filter Listeners (Looker 5.18+)
(erin.alexander) #2

Made some additional improvements to the article.

0 Likes

(erin.alexander) #3

Made some additional improvements to the article.

0 Likes