liquid with drill_fields

marc
Participant I

Hi, Im trying to achieve something along the lines of the following. I want to display a different set of details for the drill fields depending on the user attribute setting. Is this possible? I was thinking it might be able to work along the lines of what I have in the example below, but to no avail. Can I use liquid for the drill_fields attribute? If I can, what am I doing wrong in the liquid syntax?

 measure: things_count {

    type: count_distinct

    drill_fields: "{%  if _user_attributes['privacy_level'] == 'low' %} [fewer_details] {% else %} [more_details*] {% endif %}" 

    sql: ${things_id} ;;

  }

I appreciate any tips or suggestions on how to achieve this.

0 2 394
2 REPLIES 2

marc
Participant I

I’m posting my own answer here in case it helps future Lookers. This might not be the ideal solution but it does work for my needs. Liquid may not be available to use on the drill_fields, but can be with the link. It was also necessary to remove the drill_fields from the measure and have relative links to the explores in order for the behavior to match what would happen with a drill_down. 

  measure: presence_events_count {

    type: count_distinct

    link:

    {

      label: "Details"

      url: "{%  if _user_attributes['privacy_level'] == 'low' %}

      /explore/{MODEL}/{VIEW}?fields={VIEW}.fewer_details*

      {% else %}

      /explore/{MODEL}/{VIEW}?fields={VIEW}.more_details*

      {% endif %}"

    }

    sql: ${employee_id} ;;

  }

Thanks for sharing your solution! I'm looking to do something similar, and this looks like a decent workaround. A pity that liquid with drill_fields is not a viable approach - that would make things a lot simpler. 

Top Labels in this Space
Top Solution Authors