Regarding decimal field values population

Sirisha24
Tera Expert

Hi , 

I would like to know when i give decimal values in one field and there is another dependency field which populated based on first field.
For example, if i give 12 as value in first field then second value field should be * 1000 like 12000.
But when i give 1.2 it should be 1200 right but getting as 12000 

can anyone please help me how we can achieve this .

Thanks, 
Sirisha 

18 REPLIES 18

Hi Ankur , 

As you suggested i can't change type now so i need to do that scenario in different way because its all customization things.
Thanks,
Sirisha 

Robert H
Mega Sage

Hello @Sirisha24 

 

Can you please share the script that you are using to do the calculation?

In Javascript, the result should always be 1200, no matter if 1.2 is a string or an actual decimal number.

RobertH_0-1745935644648.png

 

Regards,

Robert

 

 

Hi Robert , 
We are using a system property to retrieve a value (e.g., 1000), which is then multiplied by the number of days to calculate the equivalent NFI cost. This calculation is implemented in a client script, as shown in the code snippet, which populates the u_equivalent_nfi_cost field accordingly.

Sirisha24_0-1745990682690.png


Thanks , 
Sirisha 

Hello @Sirisha24 ,

 

I guess you are doing the replaceAll() because some countries use the comma (,) as the decimal separator? But you are not replacing it with a dot (.) which is the expected separator in JavaScript.

 

Please do this instead:

var nDays = g_form.getDecimalValue('FIELD_NAME');

 

And ideally you should recreate that field as a Decimal type field if it is currently a String field.

 

Regards,

Robert

Hi Robert , 

If i gave this condition also it is going as 56 instead of 5.6.