Solved

Possible to use addition and subtraction on values?

  • 20 August 2021
  • 2 replies
  • 745 views

Badge +2

Hi,

I’d like to subtract the value of one property from the value of another.

i.e. person.apples - person.oranges

More precisely, I’d like to use it in an IF statement:

{% if  person.apples > person.oranges %}
{person_nutrition_score - person.suggested_nutrition_score}}

However, I can’t find any documentation on using simple subtraction. I’ve looked at the Django reference and also this related forum post which I’ve modeled my own post after.

Any ideas how this can be done?

icon

Best answer by stephen.trumble 20 August 2021, 20:53

View original

2 replies

Userlevel 7
Badge +60

Hey @emailjamie 

Thank you so much for asking the Klaviyo Community for insight into this! Happy to help! It always brings a smile to my face to see Community members researching and trying to solve challenges in their marketing strategy! Thank you for doing this work and bringing it to the Community for everyone to share in!

Using Variable Filters are a great way to customize your content, but at this time the variable to subtract is not supported in Klaviyo. However, you can use If-Else Blocks  to show different content depending on the your selected profile properties! @retention has a best answer on this Community post:

@retention talks through the logic behind the If-Else Block and how you can fully utilize it for personalized dynamic content. 

I am placing a product feature request on your behalf to our development team, they will look into the use case and need for this feature. If there is any new update on this, I will respond to this thread!

I hope this helps! Thank you @emailjamie and @retention for your participation in the Klaviyo Community. We truly appreciate you and the collaboration you give!

Badge

just add a negative quantity, that’s exactly the same operation in fact ;) 
just for you to know: add:-[yourfigure] works, but add:-[your_event] does not. Luckily I ve got the same negative event, so it works for me.

Reply