Decimal type field does not show decimal value.

Vaishnavi35
Tera Guru

Hi,

I have a decimal field Payback period but it does not show decimal value.

find_real_file.png

19350/252 = 77.4 but it shows only 77.

Client script for that is,

find_real_file.png

Thanks,

Vaishnavi

1 ACCEPTED SOLUTION

script i have tested on my personal instance and worked. 

function onSubmit() {
	//Type appropriate comment here, and begin script below
	var currency_amount = g_form.getIntValue('total_costs');

	var currency_code = g_form.getIntValue('score');

	g_form.setValue('u_mytest', currency_code/currency_amount);
}

 

u_mytest was initially as "integer" type . and i had more than 20 record which was holdig the value, i just deleted and changed the type and then applied onSubmit client script to set the value and its setting as decimal. 

View solution in original post

29 REPLIES 29

 

It worked in OOB, but when I tried in my instance it did not work! please check my code.

find_real_file.png

It still does not work.

Can you try this finally:

I assume both the fields are cost type.

 

var tpc =g_form.getValue('u_total_project_cost.display').replace(/,/g, ""); 
var neb =g_form.getValue('financial_benefit.display').replace(/,/g, ""); 

var total2 = parseFloat(tpc)/parseFloat(neb);
//alert('tpc = '+tpc+' neb = '+neb+' total2 = '+total2);

g_form.setValue('u_payback_period',total2);

The code is showing an error.

find_real_file.png

You are using g_form.getIntValue 

Use g_form.getValue

getValue doesnot even work. Its not showing any value only if I use that