Regarding decimal field values population
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 05:49 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 10:30 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 07:08 AM
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.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 10:28 PM
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.
Thanks ,
Sirisha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 11:45 PM - edited 04-29-2025 11:46 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 11:57 PM
Hi Robert ,
If i gave this condition also it is going as 56 instead of 5.6.