Knowledge Drop

Why do I see & #x27; in my vis legend? or, ' in the explore?

  • 15 June 2021
  • 0 replies
  • 105 views

Userlevel 5

Last tested: Dec 18, 2018
 

Bad news, TL;DR - If you use the character entity reference in LookML for any non alpha numeric character, (an apostrophe, for example) it renders correctly in the vis, but busts the explore by displaying the hex character entity reference.

When using special characters within a string definition in HTML (any label param in Looker invokes a change to end rendering), the render engine on the browser has to interpret the character. What is happening here, is that `'` is the hexadecimal character entity reference for an apostrophe, confirmed here & here

As per the second link above, if we insert the HTML character entity `'` before _Word of Mouth_ in the measure label, as shown here:

 

measure: response_share_word_of_mouth {

label: "Response share for 'Word of Mouth'"

type: number

sql: ${total_responses_word_of_mouth}/NULLIF(${total_responses},0) ;;

value_format: "0.0%"

}

 

This results in the front end rendering producing the desired set of apostrophes in the vis legend:

Render result.png

But in turn, busts the explore:

busted explore.png

 

This content is subject to limited support.                

 

 

 


0 replies

Be the first to reply!

Reply