Question

Reflect user name in dashboard

  • 20 May 2019
  • 7 replies
  • 324 views

Hi,


I would like to add a user name that will be reflected in the dashboard.

The idea each user that will use the dashboard will see the following: " Hi ‘user name’ ,welcome to my dashboard"


I have tried the below code in lookml:


dimension: attribute_test {

type: string

sql: {{ _user_attributes.[‘name’] }} ;;

# html: {{ _user_attributes.[‘name’] }} ;;

}


Tried with sql or html ,with no success.

What i’m missing here?


Thanks in advance,


Yossi.


7 replies

Userlevel 7
Badge +1

You’re super close! I think you just need to lose the period between user_attributes and the brackets. sql: {{ _user_attributes[‘name’] }} ;;

Thx Izzy,


Unfortunately, it’s not passing validation 😦


Any idea?


Thx,


Yossi.

Userlevel 7
Badge +1

What’s the error it’s failing with? If it’s not even validating in the lookml, then there’s probably just a little syntax error somewhere. If you paste in the dimension definition maybe someone here can spot it.

Hi Izzy,


Now it works 🙂 thank you!


dimension: attribute_test {

type: string

sql: 1 ;;

html: Welcome {{ _user_attributes.[“name”] }} ;;

}


Now, I’m trying to show the number of entries to my looker dashboard.

I’m trying to reflect “Dashboard User” with no success.

Please see screenshot.



Any help will be much appreciated.


Thx,


Yossi.

@izzy I actually tried this with both _user_attributes.["name"] and _user_attributes["name"] and weirdly the dot doesn’t seem to matter/break it!


Also worth noting that if code in post here isn’t formatted as ‘preformatted text’ and you copy and paste it can cause weirdness with pretty/magic/matching quotes instead of actual " or '


@Yoshimo if you want to show a count of users who have used a dashboard, in that dashboard, I think you can use the Dashboard User measure and filter for the relevant dashboard ID. You’ll have to set the ID for each dashboard where you use this though.

Userlevel 7
Badge +1

Oh, funky. I just have never used the dot before and figured that might be the problem. Thanks for the knowledge!

can we use this in markdown with html

 

Reply