In this tutorial, we will explore various types of filters we can add to a view.
...
The date
filter has identical syntax with the globalDate
filter. Its purpose is to be able to filter additional date attributes. Our transactions
dataset is simple, this it contains only one date column (transactions.date
). This filter would come to use if we had e.g. date of customer's registration.
Code Blockinfo | ||||
---|---|---|---|---|
| {
"id": "oqkjjq275beecpu7",
"name": "
| |||
When |
Code Block | ||
---|---|---|
| ||
{ "id": "oqkjjq275beecpu7", "name": "business_overview_view", "type": "view", "title": "Business overview", "description": "Overview of transactions and the location of your customer base.", "content": { "icon": "shopping_cart", "dashboard": "/rest/projects/$projectId/md/dashboards?name=business_overview_dashboard", "defaultGranularity": "/rest/projects/$projectId/md/datasets?name=zsj_dwh", "filterGroup": [ { "type": "globalDatedate", "property": "transactions.date" }, ], { "mapOptions": { "typecenter": "date",{ "propertylat": "transactions.date"49.203, } "lng": 16.606 ], "mapOptions": {}, "centerzoom": {12, "lat": 49.203,"tileLayer": "mapbox" } }, "lngaccessInfo": 16.606{ }"createdAt": "2020-06-29T13:49:07Z", "zoommodifiedAt": 12"2020-06-30T08:13:53Z", "tileLayercreatedBy": "mapbox"/rest/accounts/00ubfu7fdyIoFKxXm0h7", } "modifiedBy": "/rest/accounts/00ubfu7fdyIoFKxXm0h7" }, "accessInfolinks": {[ "createdAt": "2020-06-29T13:49:07Z",{ "modifiedAtrel": "2020-06-30T08:13:53Zself", "createdBy": "/rest/accounts/00ubfu7fdyIoFKxXm0h7", "modifiedByhref": "/rest/accounts/00ubfu7fdyIoFKxXm0h7/projects/k5t8mf2a80tay2ng/md/views/oqkjjq275beecpu7" }, } "links": [ { "rel": "self", "href": "/rest/projects/k5t8mf2a80tay2ng/md/views/oqkjjq275beecpu7" } ] } |
Use pushProject
command to update business_overview_view
view in the project.
]
} |
Use pushProject
command to update business_overview_view
view in the project.
The date
filter will now appear under the Filters tool icon ().
...
The usage is pretty straightforward - you specify URI reference to the indicator whose value you would like to filter. In this case, it is transactions_indicator
from the first tutorial. Remember that the referenced indicator (and its metric) must be present in the project.
...
title | Business overview view |
---|
...
to filter. In this case, it is transactions_indicator
from the first tutorial. Remember that the referenced indicator (and its metric) must be present in the project.
Code Block | ||
---|---|---|
| ||
{ "iconid": "shopping_cartoqkjjq275beecpu7", "dashboardname": "/rest/projects/$projectId/md/dashboards?name=business_overview_dashboardview", "defaultGranularitytype": "/rest/projects/$projectId/md/datasets?name=zsj_dwh", view", "filterGrouptitle": ["Business overview", "description": "Overview of transactions and the location of {your customer base.", "content": { "typeicon": "globalDateshopping_cart", "dashboard": "/rest/projects/$projectId/md/dashboards?name=business_overview_dashboard", "propertydefaultGranularity": "transactions.date"/rest/projects/$projectId/md/datasets?name=zsj_dwh", "filterGroup": [ }, { "type": "dateglobalDate", "property": "transactions.date" }, { "type": "indicator", "indicator": "/rest/projects/$projectId/md/indicators?name=transactions_indicator" } ], "mapOptions": { "center": { "lat": 49.203, "lng": 16.606 }, "zoom": 12, "tileLayer": "mapbox" } }, "accessInfo": { "createdAt": "2020-06-29T13:49:07Z", "modifiedAt": "2020-06-30T08:13:53Z", "createdBy": "/rest/accounts/00ubfu7fdyIoFKxXm0h7", "modifiedBy": "/rest/accounts/00ubfu7fdyIoFKxXm0h7" }, "links": [ { "rel": "self", "href": "/rest/projects/k5t8mf2a80tay2ng/md/views/oqkjjq275beecpu7" } ] } |
...
The histogram
filter is used to filter integer or decimal values. We will add a filter on the amount
property.
...
title | Business overview view |
---|
We will add a filter on the amount
property.
Code Block | ||
---|---|---|
| ||
{ "iconid": "shopping_cartoqkjjq275beecpu7", "dashboardname": "/rest/projects/$projectId/md/dashboards?name=business_overview_dashboardview", "defaultGranularitytype": "/rest/projects/$projectId/md/datasets?name=zsj_dwhview", "title": "Business "filterGroup": [overview", "description": "Overview of transactions and the location of your {customer base.", "content": { "typeicon": "globalDateshopping_cart", "dashboard": "/rest/projects/$projectId/md/dashboards?name=business_overview_dashboard", "propertydefaultGranularity": "transactions.date"/rest/projects/$projectId/md/datasets?name=zsj_dwh", "filterGroup": [ }, { "type": "dateglobalDate", "property": "transactions.date" }, { "type": "indicator", "indicator": "/rest/projects/$projectId/md/indicators?name=transactions_indicator" }, { "type": "histogram", "property": "transactions.amount", "format": { "type": "number", "fraction": 0, "symbol": "CZK" } } ], "mapOptions": { "center": { "lat": 49.203, "lng": 16.606 }, "zoom": 12, "tileLayer": "mapbox" } }, "accessInfo": { "createdAt": "2020-06-29T13:49:07Z", "modifiedAt": "2020-06-30T08:13:53Z", "createdBy": "/rest/accounts/00ubfu7fdyIoFKxXm0h7", "modifiedBy": "/rest/accounts/00ubfu7fdyIoFKxXm0h7" }, "links": [ { "rel": "self", "href": "/rest/projects/k5t8mf2a80tay2ng/md/views/oqkjjq275beecpu7" } ] } |
...
Let's add two multiSelect
filters. The first one will filter the transactions.day_name
property, which contains day names (Monday, Tuesday,... etc.) for each transaction. But since we want the day names to be correct order, we have to specify orderBy property - day_index
which contains integer index of each day.
The second filter will filter the customers.age_group
, which is in correct order by default, so we don't need an extra ordering property. But since this property filters the customers
dataset, it will belong to the "Customers" section.
...
title | Business overview view |
---|
...
. etc.) for each transaction. But since we want the day names to be correct order, we have to specify orderBy property - day_index
which contains integer index of each day.
The second filter will filter the customers.age_group
, which is in correct order by default, so we don't need an extra ordering property. But since this property filters the customers
dataset, it will belong to the "Customers" section.
Code Block | ||
---|---|---|
| ||
{ "id": "oqkjjq275beecpu7", "name": "business_overview_view", "type": "view", "title": "Business overview", "filterGroupdescription": ["Overview of transactions and the location of your {customer base.", "content": { "typeicon": "globalDateshopping_cart", "dashboard": "/rest/projects/$projectId/md/dashboards?name=business_overview_dashboard", "propertydefaultGranularity": "transactions.date"/rest/projects/$projectId/md/datasets?name=zsj_dwh", "filterGroup": [ }, { "type": "dateglobalDate", "property": "transactions.date" }, { "type": "indicator", "indicator": "/rest/projects/$projectId/md/indicators?name=transactions_indicator" }, { "type": "histogram", "property": "transactions.amount", "format": { "type": "number", "fraction": 0, "symbol": "CZK" } }, { "type": "multiSelect", "property": "transactions.day_name", "orderBy": [ { "property": "transactions.day_index", "direction": "asc" } ] }, { "type": "multiSelect", "property": "customers.age_group" } ], "mapOptions": { "center": { "lat": 49.203, "lng": 16.606 }, "zoom": 12, "tileLayer": "mapbox" } }, "accessInfo": { "createdAt": "2020-06-29T13:49:07Z", "modifiedAt": "2020-06-30T08:13:53Z", "createdBy": "/rest/accounts/00ubfu7fdyIoFKxXm0h7", "modifiedBy": "/rest/accounts/00ubfu7fdyIoFKxXm0h7" }, "links": [ { "rel": "self", "href": "/rest/projects/k5t8mf2a80tay2ng/md/views/oqkjjq275beecpu7" } ] } |
...