Knowledge Drop

How to use access filters in derived tables

  • 8 July 2021
  • 0 replies
  • 109 views

Userlevel 4

Last tested: Oct 31, 2019
 

Question

How do I use access filters inside the SQL of a derived table?

An Answer

All that access filters do is apply a user attribute value to a field as a condition. So, basically, just write a WHERE condition in the derived table, calling the user attribute via Liquid.

Example

If you have an access filter like so:

 

access_filter: {

field: department

user_attribute: dept

}

 

and derived table SQL like so:

sql: SELECT * FROM table ;;

 

then you can simply add a WHERE to the derived table SQL like so:

sql: SELECT * FROM table WHERE department = {{ _user_attributes['dept'] }} ;;

 

 

Disclaimer

Please note that the PDT Regenerator has no user attribute values, so it will input a blank for {{ _user_attributes['dept'] }} in the above example. For this reason, a derived table which references user attributes via Liquid should not be a PDT.

 

This content is subject to limited support.                

 

 


0 replies

Be the first to reply!

Reply