Decimal precision

Hello to all.
I searched the forum and in the examples, but … nothing!
I would need to parameterize decimal precision of a ‘decimal’ field leaving of course the setting ‘Regional settings’ as planned.
There is no or I do not find the ability to associate a ‘mask’ to the field, else I’ll do it all manually!
In db, this field is decimal (13,5), but according to the customer configuration I the need to perform input with 2, 3, 4 or 5 decimal places.
How can I do? there is another way?
Hello and thanks
Enrico

what you mean by parameterize decimal precision… decimal works fine the way you said assuming field type decimal x,x and in scriptcase storing and retrieving the numbers correctly, can you explain more?

Hello Mike.
Thanks for the reply.
The significance of being able to parameterize conditionally decimal input and output (not in the db!) Is that a customer / company may need to use or not use decimals for example in quantities!

I’m finishing a project for the management of sales, purchases and inventory. Each company has its db. In db I put the ‘amount’ fields and ‘amounts’ unit in decimal (13.5), the totals are obviously decimal (13.2)
For example, the baker needs of quantities with decimals to the tenth (or penny): flour type 00 Kg 2,500, flour type 0 Kg 0.250 … and so on.
The services company, repairs, etc. It will use the amount to ‘whole’: nr. of the services provided (…!).
Yet. My management uses currency according to the nation.
Eg. The customer of romania (currency you / Ron) or of Ethiopia (Birr) have no decimal point for the currency, … while the Iraqi dinar, Jordan, etc … use at least 3 decimals as their currency (but not customers Iraqis!).
Even with the European euro a company may need to also use 4 or 5 decimals as unit amount.

My question concerned the possibility to parameterize the decimal number with regard to the input and output. During the processing already thinks the code with sc_num_format (), round (), etc … according to the configuration that each customer has selected.
The client who does not want decimals nonetheless find an input or output field with all decimal provided in the db.

I bring this real example. The Romanian company, my client, you will find input and a grid line: art. 01 … 100.00000 quantity and unit value = 5,000.00000 500,000.00000 (instead of 100 x 5,000 = 500,000)

Looking at the source that uses the properties ‘precision: 5’ … I thought that with javascript you could configure. But even if it were possible I’m not capable! :slight_smile:


<input class="sc-js-input scFormObjectOdd css_art_listino0_obj" style="text-align: right;"
id="id_sc_field_art_listino0" type="text" name="art_listino0" value="1,11000" size="13" alt="{datatype: 'decimal', maxLength: 13,
precision: 5, decimalSep: ',', thousandsSep: '.', thousandsFormat: 1, manualDecimals: true, allowNegative: true,
onlyNegative: false, enterTab: false, enterSubmit: false, autoTab: false, selectOnFocus: false, watermark: '',
watermarkClass: 'scFormObjectOddWm', maskChars: '(){}[].,;:-+/ '}" maxlength="16">

Hello and thanks.
Enrico

well, seems too complicated if used all for one field, that is my opinion, and sorry don’t know how it can be done… the only thing i can think of is to have different field for each company with required decimal places they need…

since javascript is concerned to acomplish your way, only one person i know may give you straight forward solution, but not sure if is around in the forum these days jsb or maybe Albert aducom…?

Thanks for the reply mike.
No matter … I will leave the mask of the fields as well, until a new idea! :slight_smile:
I should do six input fields for each field that can be configured to use different combinations! and I do not think the case …! :slight_smile:
Only integers and 1 to 5 decimal … fields are at least 3 … 18 total fields!
Hello and thanks
Enrico

18 total fields i see it resonable not to go through java dillema :slight_smile: