0

Is there a way that I can pull a personalization string variable, such as someone's last purchase amount, and multiply it? For example:

I pull %%Last Purchase Amount%%, which is 100, and I want to multiply it by 1.5 so that the string resolves to 150. Is there a way I can do this through AMPscript or something?

Thanks!

1

Sure thing.

You could do something like this:

%%[

var @lastPurchaseAmount
set @lastPurchaseAmount= AttributeValue("Last Purchase Amount")

if empty(@lastPurchaseAmount) then
  set @lastPurchaseAmount = "0"
else 
  set @lastPurchaseAmount = multiply(@lastPurchaseAmount,1.5) 
endif

]%%
<br>Last Purchase Amount: %%=v(@lastPurchaseAmount)=%%

You can also format the output using the FormatNumber(), FormatCurrency() or Format() functions.

Reference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.