Access Filter with manipulated User Attribute

Hi there,

Is there a way to manipulate a string from a user_attribute to use with an access filter?

I currently receive a attribute in the form of a simple string ‘1.1.1’.
I need append a ‘.%’ to such value, as exemplified below, so I can use in a LIKE operation.

explorer: B{
   extends

   access_filter: {
      field: employee.hierarchy
     user_attribute: CONCAT(hierarchy, ‘.%’)
  }

}

Things to consider:

  1. I can't change the received parameter. Receiving it with ‘.%’ would already solve the problem.
  2. I can't use sql_always_where, cause this explorer extends another, which already uses it (can't override)
Solved Solved
0 4 895
1 ACCEPTED SOLUTION

Hi @nestor!

Option 1: When you want to extend another explore, but still refine a sql_always_where or other string/block declarations, you can use often ${EXTENDED} to interpolate the value from the original declaration.

For example:
sql_always_where: ${EXTENDED} AND <additional condition>

(Non) Option 2: Within the access_filter block, there wouldn’t be a way to apply logic/liquid, as it only accepts a direct reference to a provided user attribute

Option 3: If the field referenced in the access_filter>field is a filter-type declaration, you can use its `sql` declaration to customize how the filter is applied. In your use case, I think you can really only express a single simple filter rule this way (rather than leverage {% condition %} tag)
view: employee {
  filter: heirarchy {
    sql: ${heirarchy_dimension} LIKE CONCAT({% parameter heirarchy %},’.%’) ;;
  }
}

View solution in original post

4 REPLIES 4
Top Labels in this Space
Top Solution Authors