Solved

How to use liquid / ifelse statements in large headings without losing overview in editor

  • 3 April 2023
  • 1 reply
  • 31 views

I am probably doing it the wrong way. But when using code with large text size its ruining the overview within the editor. 

Is there a way to use code without this happening? 

 

icon

Best answer by Ramy 7 April 2023, 16:22

View original

1 reply

Userlevel 1
Badge

Hello!

 

That is surely not what you want; happy to help with some tips on how to avoid that!

 

Generally speaking, I would recommend formatting text boxes containing Liquid Code, after the syntax is written and you can see it is working well, because the alternative, would be shrinking down the font size and then back up whenever you want to review the code in depth.

 

More over, when using Liquid with the Drag and Drop editor, we recommend doing so via the button “more” > “Add Liquid”. The reason for that, is that when copying or writing Liquid Code in a formatted Text box, the formatting sometimes can affect Liquid and cause it not to work because of HTML tags. We explore this in that section of our Drag and Drop Docs!

 

Finally, and this is unrelated to the Display issue, but I hope is still helpful! Looking at the segment of code shown in your screenshot, I would have to think that this Liquid is most likely to show the error “comparison of String with 40 failed”.
The reason is that Customer.io stores all attributes as strings -including numbers-. That is why to perform a Math operation on an attribute, you need to ‘convert’ it to an integer. You can do that by adding a “ | plus: 0” to your code before the evaluation. Here’s an example from our Documentation that should be helpful: Maths Operations with Attributes.

 

Hope this is helpful! Please let us know if you still have questions and we’ll be more than happy to jump back in and help you with those too! ^_^

Best,

Reply