Knowledge Drop

Is there a way to do an "IN" or "contains" function in liquid?

  • 28 June 2021
  • 3 replies
  • 490 views

Userlevel 4

Last tested: Jun 17, 2020
 

Yep!

For example, this liquid will turn the background color of a value red if the value contains "Test":

sql: ${TABLE}.field_name;; html: {% if value contains "Test" %} <p style="color: black; background-color: red; font-weight:bold">{{ rendered_value }}</p> {% else %} {{ rendered_value }} {% endif %} ;;
 

 

This content is subject to limited support.                

 

 


3 replies

@molly.lippsett Where can I find exhaustive list of function that liquid supports?

 

Userlevel 4

Liquid variable reference should do it!

@molly.lippsett Thank you!! That was really helpful. Just a follow up question - do you know which liquid version looker uses? I want to use whitespace control but seems like its present with liquid 4.0.0 only

Reply