Question

LookML Liquid Template Bug

  • 11 November 2015
  • 5 replies
  • 251 views

Userlevel 1

This is the Liquid templating code I am using for a measure of type:sum. This for loop should take the array created by (link | split: ‘&f’), skip the first element (offset:1), and append the rest of the elements to “user_filters.” In reality, it is treating (link | split: ‘&f’) as a string and appending the whole “link” to user_filters in one go.



5 replies

Userlevel 1

Another problem is that when I just assign an empty string to a variable as seen in this picture, I get this “undefined method ‘lookups’ for “”:String” error. All I am doing is assigning an empty string.



Userlevel 3

Hey Erin,


We are investigating your second comment as a possible bug and will update this post when we know more.


As for the main topic I believe this doing something like this should work


      {% assign url = link | split: 'amp;f' %}
{% for url_part in url offset:1 %}
{{ url_part }}
{% endfor %}

Note the change from &f to amp;f

Userlevel 1

Hi Nicole,


I tried that exact code that you posted, and it is still not splitting the link at ‘&f’.


Thanks for investigating the possible bug, please do let me know.

Userlevel 6
Badge

@Erin_Breen What would you like the link to do? I see you are building up a link, but I’m not sure what your desired outcome is. We are working on this part of the code, I want to make sure your use case is covered by what we are building.

Userlevel 1

Hi @lloydtabb thanks for your help


I want to be able to split the link where there is “&f.” Then I want to ignore the first item in the split array, and append the following url_parts to a string. Within the for loop, I may want to transform the url_part before appending if the url_part contains certain text.


When I use the above code, the link does not split into an array as expected.

Reply