Calculation of 2 parameters - error

I have 2 parameters:

{proposal_totalAmount}, {proposal_discountAmount}

Both are text-inputted fields, to allow formatting(eg. 2,000,000.23 instead of 2000000.23)

I’m trying to work on it using the following formula:

{proposal_calcAmount} = {proposal_totalAmount} - {proposal_discountAmount}

I will then use {proposal_calcAmount} to compare against another field, {proposal_amount} which I obtained using Return only Numbers from Text

I’ve tried both Evalute Mathematical Expressions


Equals {proposal_amount}

and Execute using Javascript

var x = {proposal_totalAmount}  - {proposal_discountAmount
return Number(x); 

Equals {proposal_amount}

Both returned error, something along the lines of

[output] is not equal to [249975.00]

Where am I going wrong?


After much search and debate, I found out why.
The default values for
{proposal_totalAmount}, {proposal_discountAmount}, as mentioned at the start, both include a comma( , ) in the value(the comma is only for formatting/viewing), which is where the issue is coming from.

Hi @erik.yeow,
To evaluate strings with mathematical expressions, you will need to convert them to numbers (int, float).
Please try to use the ‘Convert String To Number’ action to convert the parameters ({proposal_totalAmount}, {proposal_discountAmount}) from strings to numbers before making any evaluations.

This topic was automatically closed after 180 days. New replies are no longer allowed.