User-context attributes are used to dynamically filter the data within a dataset based on a certain user attribute such as username, email, mobile, or any custom property. It means, a logged-in user can only view the data based on his user-context value set by the administrator in the Admin Portal. Note that when you want to add a parameter based on a user-context attribute, you should make sure that the dataset contains similar field as that of the user-context attribute.
For more information, refer to the following articles-
Consider a scenario where you want the regional managers of BC, OR, and WA to view the data only for their respective regions. It means, the regional manager of region BC can only view the data for region BC, similarly, the regional manager for region OR can only view the data for region OR, and so on.
On the Admin Portal, navigate to Account > Custom Property to add a new property 'region'.
Then, jump to Users and specify the region values for the users.
On the Resource Portal, go to Dataset, select a dataset and click Edit.
In the dataset designer, navigate to the Parameters tab and click Add Parameter button.
Set the properties for the new parameter such as its type, data type, and context field. In the following example, Parameter Type is set to 'User Context', Data Type to String, and Context Field to 'region'.
To filter the data based on the parameter value, jump to the Filters tab of the designer and click the Add rule button to add a dataset filter.
Now, specify the filter properties such as the field on which you want to apply the filter, filter value type, and its value. In the following example, set the Field to 'Region', ValueType to 'Parameter', and Value to 'Parameter1'. This will now filter the data based on the user's region value.
Finally, click the Save button.