Embedding: Role based Dashboard Filtering
Dashboard Filtered based on the user role.
Last updated
Dashboard Filtered based on the user role.
Last updated
Create a Dashboard Filter
In your dashboard, create a new âDashboard Filterâ.
In the "Apply On" section, enable the App Filter option.
You can link a guest token here to pass the filter values dynamically.
Refer the below document to generate a guest token.
Make sure the options and values match the data type of the filter for successful integration.
Letâs assume you have three roles:
Admin
Editor
Viewer
And two Dashboard Filters:
Country: ["USA","CANADA","MEXICO","CHINA","INDIA"]
Company: ["ALPHABET","GOOGLE","APPLE"]
And below is the access level of each role:
Admin
All Companies
All Countries
Editor
All Companies
USA, CANADA, MEXICO
Viewer
Alphabet
USA
Now using the information from the table above, you can input the values to generate a guest token according to the specified role.
Guest token for Admin:
Guest token for Editor :
Guest token for Viewer:
For filters involving a large number of options (e.g., over 500), manually passing all values becomes inefficient. By integrating SQL, you can dynamically fetch options from your database, simplifying the process and improving efficiency.
The SQL query specified under the "sql" key dynamically fetches the latest values from the specified database table.
Letâs modify the earlier example for Admin to demonstrate SQL integration for dynamically fetching filter options:
Guest Token for Admin with SQL Integration
Dynamic Updates: The SQL query retrieves only the latest relevant options from your database.
Example: SELECT "name" FROM "public"."countries" WHERE isEnabled=true
fetches active country names.
Efficiency: Eliminates the need to manually manage large datasets in the configuration.
Flexibility: The columnName
specifies the field in the query result to use as filter values.
Scalability: Handles thousands of options seamlessly, reducing payload size and improving performance.
This approach ensures that filters remain efficient, scalable, and user-friendly, with minimal manual effort to keep options up to date.