cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Changing currency code to a symbol & title case conversion for multiple words

l3nxie101
Active Member

I'm new here so hi everyone - nice to meet you!

I'm trying to figure out if I'm able to change a currency code to a symbol by using filters or similar. Is that possible? Also, is there a way to capitalize the first letter of each word in a string, rather than just the first word?

Thank you!

2 ACCEPTED SOLUTIONS

Dany
Active Member II

Hi,
As for the capitalization, there you go:
https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/liquid/liquid_use_cases#mi...

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




View solution in original post

DavidO
Strategist

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) 

View solution in original post

4 REPLIES 4

Dany
Active Member II

Hi,
As for the capitalization, there you go:
https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/liquid/liquid_use_cases#mi...

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




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}}

DavidO
Strategist

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)