Using User Attributes in AQL
Introduction
By using User Attribute in AQL, you can mask the data you don't want your users to see, or manipulate how the values will be returned based on User Attribute setup of the current logged in users.
Please follow our examples below to understand more how it works:
Grant access to see customer personal info only for a selected group of users
Read this case here in Column-level Access Control.
Display field values based on User Attributes
Use-case
Default GMV is in USD, for users who are in Singapore you want to show GMV in SGD, and for users who are in Vietnam you want to show GMV in VND.
How-to
Firstly, set up User Attribute currency
for each user in User Management
Then, in your Data Model or Dataset, create a new field Localized GMV
which returns appropriate GMV value according to the currently logged in user's User Attribute currency
case(
when: in('ALL', H.current_user.currency),
then: ecommerce_orders_master.gmv,
when: in('SGD', H.current_user.currency),
then: ecommerce_orders_master.gmv * 1.36,
when: in('VND', H.current_user.currency),
then: ecommerce_orders_master.gmv * 23180,
else:
ecommerce_orders_master.gmv
)
Test your logic with Edit and View as feature