I am building a “status check” view. I would like to show one of three values, for each status:
Critical, based on the value of some underlying SQL query building a metric.
The way I currently have it built is with three hidden dimensions (one for each status), and a collections of metric dimensions for each things I want to track. Each metric dimension has a SQL CASE that returns a reference to one of my status dimensions, depending on its value.
This all works fine, but I would really like to add color to each status’s text (green, yellow, red). I added HTML annotations to the status dimensions, but it appears that referencing those dimensions in my metrics only pulls the value, not the HTML rendered value.
I know one way to solve this is to include my HTML formatting on each metric dimension, but I would rather “refactor” it out into a common spot so all metric dimensions can refer to a common formatter.
As of Looker 6.12, there is a new project manifest parameter called constants. With this new feature, anytime I find myself copy and pasting in LookML, I’ve been thinking how I could use constants to gain re-usability. It sounds like that might the same in your case, in stead of copy pasting, you would like to reference one value multiple times; constants may be your solution.
Here’s a quick example:
I hope this helps.