APIs & Integrations

CraigWish
Participant

Displaying data with multiple rows, in a template

Hi everyone, I hope someone could help.

I have my API bringing a number of values on one property. For example:

 

Topic one 
Topic two
Topic three
Topic four

 

When I added them to an email template the display email looks like this:

 

Topic one Topic two Topic three Topic four

 

 

How do you modify the email template to represent the line breaks?



0 Upvotes
3 Replies 3
Jaycee_Lewis
Community Manager
Community Manager

Displaying data with multiple rows, in a template

Hey, @CraigWish 👋

 

Have you looked into using the HubL filter `split`? And using a for loop? The one issue I see is you are not using a separator for your values. For that, I do not have a filter option. Here's a quick simple example assuming commas were used:

{% set topics = "Topic one,Topic two,Topic three,Topic four"|split(',') %}
{% for topic in topics %}
   {{ topic }}<br/>
{% endfor %}

 

Hey, @Anton @Stephanie-OG, is there a better or different way you'd handle this type of challenge?

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

CraigWish
Participant

Displaying data with multiple rows, in a template

I'm trying to figure out the. synctax for using Spilit on a property.
For example:

{% set topics = {{comapany.property_name}}"|split('<br>') %}
{% for topic in topics %}
   {{ topic }}<br/>
{% endfor %}

 

@Jaycee_Lewis what do you think?

0 Upvotes
CraigWish
Participant

Displaying data with multiple rows, in a template

Thank you @Jaycee_Lewis - let me try this.

What I'm trying, without success yet are:

  • Changing the property type to Rich Text
  • Using the API to import data using the following format

 

Topic one<br>Topic two<br>Topic three<br>Topic four​

 

However, when I display the content within the template it display's the like the above code snipet... it doesn't know <br> is HTML. 

 

0 Upvotes