- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 04:04 AM
Hi All,
We have field on custom table in global application. Field type is "Floating point number". There are 2 issues due to this field.
As there is data on this table, we are not able to change the field type on the table. To create a new field, this table is referred in multiple catalogs which are already in function.
1) The first issue is while we try to edit this field value on the table as decimal value ex: 1.99 it change to 199, while we try with 1.990 it is same as 1.990. Also if we try 50,000 values after ',' are truncated and the value is set to 50. Is there a way to limit the decimal to 2 places and not change the value.
2) The second issue is when trying to read the value from table to a catalog form variable type single line text, decimal point is removed from the value, ex On table value is 1.990 on the form variable it shows as 1990.
client script to set value on form field is - g_form.setValue('ppu', parsedData.price);
here parsedData is parsed JSON object as we are returning multiple values from script include.
fetching value from table in script include as - price_per_unit = getInv.u_price_unit_wp;
Divya
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 05:20 AM
Then your system is not using a period as decimal, but probably a comma. Check on your system settings.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 04:41 AM
I think you already answered your own question: the field type is just wrong. Why try to work around something of which you know it is causing the issues currently (and who knows what issues it will cost in the future).
Create a new field of the correct type. Write a fix script to move all existing data from the old field to the new and go through your catalog items where you are using it. Not fun work to do, but it will save you a lot of headaches in the future.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 04:58 AM
Hi Mark,
Thank you for the response. I have created a new Decimal type field as you suggested, but while trying to enter the data to the field, decimal is shifting the position, ex if I try 50.23 it's saving as 5.023.
Thank you,
Divya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 05:20 AM
Then your system is not using a period as decimal, but probably a comma. Check on your system settings.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 07:28 AM
Hi @Mark Manders,
Thank you for the idea.
I set the format to none for the field attributes, not sure if this had any effect. But while entering the value with comma instead of period and saving the record gives the expected result. Ex entering 50,23 value after saving it is 50.23 .
Regards,
Divya