Portal | Homepage | Blog

Math Possible with NitroScript Variables?


#1

Is the following possible with the right syntax?:
{product['product_weblinxcustomnumber1'] - product['product_stock']}

Basically, I need to subtract the value of product_stock from product_weblinxcustomnumber1 and “echo” the calculated value…

I’ve tried a couple different ways and have not been able to perform any math calculations… Is this possible?


#2

Hi Derek,

The best way to do that would be to calculate the correct amount in the mappings itself.

For example you could create another weblinxcustomnumber that would contain:

stock_nm-(quantity-quantitycommitted)

And then output that custom field on the webstore.

Regards,

Peter


#3

Gotcha. It would be really cool if we could do math with these variables. It would allow use to spare those precious few custom mappings!

Thank you for the info :slight_smile: