Hi,
We want to show the loyalty card number in e-mails to our customers. You can have multiple loyalty card numbers, so it is an array.
We want to show the loyalty card number that starts with 2616. How can I do that?
{{profile._company.LoyaltyCards.LoyaltyCardNumber}}
If I make an each and then add the field, it will show every loyalty card number, but I only want to show the one that starts with 2616.
Solved! Go to Solution.
Views
Replies
Total Likes
You can try this
{% let idx = 0 %}
{{#each profile._company.LoyaltyCards as |p|}}
{%#if startsWith(p,"2616") and idx < 1 %}
{{p}}
{% let idx = idx + 1%}
{%/if%}{{/each}}
You can have a helper on the following lines -
{{#each profile._company.LoyaltyCards.LoyaltyCardNumber as |p|}}
{%#if startsWith(p,"2616") %}
{{p}}
{%/if%}
{{/each}}
Views
Replies
Total Likes
Hi,
I tried this:
{{#each profile._company.LoyaltyCards as|entry|}} {%#if startsWith(entry.LoyaltyCardNumber,"2616")%} {{entry.LoyaltyCardNumber}}
{%else if doesNotStartWith(entry.LoyaltyCardNumber, "2616")%} {%/if%} {{/each}} 2616069166373 else 2616069171476 2616069173081 2616069171506 The profile can have multiple loyalty card numbers and in this case also multiple loyalty card numbers that start with 2616 |
Views
Replies
Total Likes
You can try this
{% let idx = 0 %}
{{#each profile._company.LoyaltyCards as |p|}}
{%#if startsWith(p,"2616") and idx < 1 %}
{{p}}
{% let idx = idx + 1%}
{%/if%}{{/each}}
Views
Likes
Replies