Re-use field level formatting

development
fr
#1

There are some cases where a field has the same formatting requirements as other fields that are named differently. For example a score field that has colour formatting based on the value of the score and there is a x_score and a y_score and a z_score all with the same formatting requirements. A way to define this once would be beneficial rather than repeating LookML across may views and if the conditional formatting changes then changing in multiple places.
I guess could define parameters in the top level view that is used in extended views to keep the variable parts in one place but maybe there is a better way.
Off the top it sounds like a field level extend but that seems like it could be kind of complicated.

0 Likes

(Jeff Huth) #2

It would be helpful for conditional formatting to define re-usable, parameter-driven, html code blocks. For example - something like html-formatting templates. Then we could apply and re-apply this template across multiple measures.

0 Likes

(Izzy) #3

I thiiink that LookML constants (released in 6.12 just now) will allow you to define any kind of constant once, and use it anywhere in your LookML.

Holding off on being 100% confident until I’ve tested, though.

0 Likes

(Menashe Hamm) #4

I haven’t seen 6.12 yet so perhaps this comment is already moot, but another benefit of reusable field-level parameters is group_label: if you want to change the label on a group, you’d be able to edit it in one place and affect the whole group.

1 Like