One question, infinite customization - Lookup Tables and User Attributes

Using user attributes in a query for infinite customization

Use Zing’s Row Level Security and User Attributes capabilities to create questions which are dynamic to which user is viewing a question or dashboard. For instance,

 This video walk through step-by-step:

Here’s how to do it:

1. Set up the lookup table

Create a lookup table within your data source, which to maps a user’s logged in email address to attributes about them. 

It should have an ’email’ field, and any other field names you’d like to be able to access as user attributes to customize query results.

2. Connect your data source to Zing and invite colleagues

From the  Zing Web Console, or the mobile apps, click on ‘data sources’ then ‘add’ to connect to your Snowflake, Postgres, mySQL, ClickHouse, Trino, Presto, Starburst, MS SQL, Google BigQuery, Google Sheets, or Databricks source. 

Invite colleagues by tapping ‘invite’ from the web console, or inviting a user from the mobile or web apps from a specific question.

3. Turn on Row Level Security and define a lookup table

From the Zing Web Console,

  1. Tap on ‘Data Sources’ then ‘Settings’

  2. Turn on the ‘Row Level Security’ switch and specify the lookup table, and the email field (this is used as the key to lookup other fields for a given user)

4. Ask questions and share

Asking questions in Zing that use a user’s specific attributes is achieved by applying a filter to questions.

{{zing.user.attribute}} 

where attribute is any field name.

For the example lookup table above, available attributes are:

  • {{zing.user.email}}
  • {{zing.user.Office_Location}}
  • {{zing.user.Role}}
  • {{zing.user.Team}}

So if you wanted each user to see the sum of sales for their office location, you’d add a filter on the Office_Location field as follows:

From there, you can save this question, add it to a dashboard, or share it with colleagues – and the results of the question will be filtered to their specific user attributes.

Detailed setup instructions are here in the docs. And of course, feel free to reach out to our team if you need hand!

Related articles

Download Zing For Free

Available on iOS, Android, and the web

Learn how Zing can help you and your organization collaborate with data

Schedule Demo