How to mask an array in AML?

I’ve got an array field that I want to mask based on User Attributes.

This was my first attempt:

case(
  when:
    in(1, H.current_user.pii_access),
  then: core_table.array_data,
  else: '(Restricted)'
)

The AML parses fine, but when I attempt to display the field in a widget I get the following error:

Error when executing SQL: (snowflake-sdk code: 001038) SQL compilation error: Can not convert parameter ''(Restricted)'' of type [VARCHAR(12)] into expected type [ARRAY]

I’ve tried casting core_table.array_data to a string, that doesn’t seem to work.
I also haven’t found any way of turning the string into an array.

I could do the cast in SQL but then I can’t refer to the user attributes.

Is there any way I can do this in Holistics without changing the field type in my source Snowflake database?

Hi Loren,

Thank you for posting your question!

At the moment, Holistics doesn’t support the Array type in a business calculation field hence showing the error. A possible approach is to create a custom dimension in your model where you cast from Array to String type, then replace core_table.array_data with that custom dimension.

I hope this is helpful. If you have any other questions or concerns, you’re more than welcome to reach out and let us know.

1 Like