Reload users metadata task¶
Dashboards can be filtered by users' metadata. The most common use case is to filter a sales dashboard according to the business unit of sales representative. When a sales representative opens his dashboard, he only sees the data from its business unit.
To achieve that, our engine must know the business unit of each sales representative. In Serenytics, we call such data the users' metadata. Using this metadata, each login can be associated with a set of fields and these fields can be used to filter a dashboard.
See the filtering documentation here (see filter data with login) to learn more about how to apply this filter.
The task named "Reload users metadata" can be used to load the metadata fields for a list of users.
How to Load metadata for each user¶
Create a new data source with one row by user (it can be any kind of source, for instance a CSV or a SQL server). The first column must be named login and its values must correspond to the username of the users of your organization in Serenytics. The others columns will be loaded as metadata fields.
Then create a task "Reload user metadata" and select the newly created data source. Run the task and you're ready to filter data based on who is viewing your dashboard.
Once the task has run, you can open the list of users in the Admin section to check that the metadata has been loaded correctly. Warning: you may need to refresh your page in your browser to see the new metadata.
How to filter a field with several values¶
Using our sales example, let's say a sales representative belongs to several business units. In this case, in
the metadata, you need to load a list of values, such as:
Note that if the type of the values is string, you must use double quotes to specify the values inside the square
brackets. If the values are integer, you can use
[1,2,4]. And use an empty array if the list is empty:
Then, when configuring the filtering options in your dashboard, use the
in operator (such as:
bu in $$login.business_unit$$).