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

The below code is tested, it works:

var tpc = g_form.getValue('u_total_project_cost').split(';')[1].replace(/,/g, ""); 
var neb = g_form.getValue('financial_benefit').split(';')[1].replace(/,/g, ""); 

var total2 = parseFloat(tpc)/parseFloat(neb);

alert('tpc = '+tpc+' neb = '+neb+' total2 = '+total2);
g_form.setValue('u_payback_period',total2);

 

If it doesn't work, then can you at least paste what are you getting in alert.

 

I get this when I try this code:

Its not showing any value in the field. I am not sure why.

The code somehow does not work for me.

No Error but it did not show any value in the field in the form. 

I am not an expert as well.

Thanks & Regards,

Vaishnavi

Harsh Vardhan
Giga Patron

While adding the " 77.4" manually, is it considering as decimal ?

Hi Harsha,

I did not get you??

Total Project Cost(currency)/Est., Total Benefit(currency) = Payback period(decimal) fields.

I have tried removing USD in the code it worked in OOB but not in my instance 😞 Not sure why!

find_real_file.png

i am saying,disable the script and manually add that 77.4 on that column and save it, see if its accepting or not. if its accepting check if you have script written correctly here. 

add alert to troubleshoot it.