Forum Discussion
Changing currency code to a symbol & title case conversion for multiple words
- 8 months ago
Hi,
As for the capitalization, there you go:
https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/liquid/liquid_use_cases#misc-capitalize-words-string
For the currency, you can use a liquid that would refer to the attribute/property and convert it via case logic:{% assign currency_code = "USD" %}
{% case currency_code %}
{% when 'USD' %}
$
{% when 'EUR' %}
€
{% when 'GBP' %}
£
{% else %}
{{ currency_code }}
{% endcase %}
You can use the currency code as a default fallback.
Here you can pick the currency codes:
https://en.wikipedia.org/wiki/ISO_4217 - 8 months ago
Hi l3nxie101 nice to meet you as well.
To add to Dany 's great response regarding capitalization using arrays, I also have a video about using 'for loops' in Braze that can help you not only understand what is happening with the array but allow you to build out increased levels of complexity for your use case.
Happy Brazing!
Discover the power of liquid for loops in Braze: Beginner tutorial (youtube.com)
Thanks for your help here! DanyWillis DavidO (video was really great!) - I really appreciate it. My reply has been slow as I've been learning more about liquid. I seem to have got that working, but i'm a little stumped now on how to use the filter 'join' to make sure the currency symbol isn't orphaned from the number. Also, is there a way to put the symbol at the front for some currencies and at the end for others? I've been scouring the guides but I cant seem to figure this out. Thank you in advance.
And the liquid would help:
{% assign CurrencyIsoCode = {{custom_attribute.${CurrencyIsoCode}}}%}
{% case CurrencyIsoCode %}
{% when 'EUR' %}
€
{% when 'GBP' %}
£
{% when 'CZK' %}
Kč
{% when ‘DKK %}
kr
{% when ‘SEK %}
kr
{% endcase %}
{{custom_attribute.${Total_Repaid__c} | round | number_with_delimiter}}
Related Content
- 4 months ago