Link to home
Start Free TrialLog in
Avatar of twardnw
twardnwFlag for United States of America

asked on

Calculated money values above 1000 generate 'NaN'

Overall goal : calculate a 'weighted revenue' for an opportunity based on the estimated revenue and a probability percent. Probability is a picklist of % values, with an onChange script to generate the weighted value.

With any estimated value over $1000 (which CRM reformats as 1,000.00), the weighted value changes to 'NaN'. Here is one line of my script to calculate this value:

crmForm.all.new_weight.value = 0.5 * crmForm.all.estimatedvalue.value;

if I change to using .DataValue, no amount is calculated for the weighted value.
ASKER CERTIFIED SOLUTION
Avatar of crm_info
crm_info
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of twardnw

ASKER

1) using :
crmForm.all.new_weight.DataValue = 0.5 * crmForm.all.estimatedvalue.DataValue;
doesn't generate anything at all, the new_weight attribute does not change

2) we are using only user-entered info for estimated value

3) field is not r/o

4) That was asking how to have the percentage on the form to use for the calculation, this is asking the exact syntax on the calculation. I closed that one before I realized it wasn't working, I didn't include any values over 1000 when I tested, salesperson pointed it out to me later.
Avatar of twardnw

ASKER

Ok, had another issue to take care of so I called our MS Partner, I was unaware that CRM was case sensitive. Changing .datavalue to .DataValue solved the issue. You had me in the right direction, just my noobness got in the way. Thanks for your help.
Ah - makes sense - I've spent more hours frustrated with case sensitivity of JavaScript than I'd like to admit.  Glad it worked out for you.