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.
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.
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
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.
Hi
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
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.