html

LookML
Version

On this Page
Docs Menu

Go to Field Parameter List

Definition

The html parameter enables you to specify the HTML that will be contained by a field. You can get access to the values that would typically be in the field by using Liquid variables. Interesting functionality can be created in this manner, including links to other related looks, links to external websites, images, etc.

Below is an example of adding the picture of a product into Looker, based on the product’s ID:

- dimension: product_image sql: ${product_id} html: | <img src="http://www.acme.com/product_images/{{ value }}.jpg" />

Liquid Variables

The html parameter supports liquid variables. See the Liquid Variables page for information about how to use these variables. They are very important in making full use of the html parameter.

Examples

Insert a product ID into an <img> tag to generate product images:

- dimension: product_image sql: ${product_id} html: | <img src="http://www.acme.com/product_images/{{ value }}.jpg" />

This example shows how most of the Liquid variables would appear in an html parameter. Considering a total_order_amount definition like this …

- measure: total_order_amount type: sum sql: ${order_amount}; value_format: '0.00' html: | <ul> <li> value: {{ value }} </li> <li> rendered_value: {{ rendered_value }} </li> <li> linked_value: {{ linked_value }} </li> <li> link: {{ link }} </li> <li> model: {{ _model._name }} </li> <li> view: {{ _view._name }} </li> <li> explore: {{ _explore._name }} </li> <li> field: {{ _field._name }} </li> <li> dialect: {{ _dialect._name }} </li> <li> access filter: {{ _access_filters["company.name"] }} </li> <li> user attribute: {{ _user_attributes["region"] }} </li> <li> query timezone: {{ _query._query_timezone }} </li> <li> filters: {{ _filters["order.total_order_amount"] }} </li> </ul>

… the cell value displayed for total_order_amount would look like this:

• value: 8521935
• rendered_value: 8,521,935.00
• linked_value: 8,521,935.00
• link: /explore/thelook/orders?fields=orders.order_amount&limit=500
• model: thelook
• view: orders
• explore: order_items
• field: total_order_amount
• dialect: mysql
• access filter: acme
• user attribute: northeast
• query timezone: America/Los_Angeles
• filters: NOT NULL

Conditionally format a count according to its values:

- measure: formatted_count type: count html: | {% if value > 100 %} <font color="darkgreen">{{ rendered_value }}</font> {% elsif value > 50 %} <font color="goldenrod">{{ rendered_value }}</font> {% else %} <font color="darkred">{{ rendered_value }}</font> {% endif %}

Still have questions?
Go to Discourse - or - Email Support
Top