Invalid Initial value

Posted by e.schutten on 06-Jun-2017 09:30

During the load of a df I get the error message "Error during ADD FIELD tx2_max, Invalid Initial value".


ADD FIELD "tx2_max" OF "tx2_mstr" AS decimal
DESCRIPTION "The maximum amount for which the tax can be applied."
FORMAT ">>>,>>>,>>>,>>9.99<"
INITIAL "999,999,999,999.99"
LABEL "Maximum Taxable Amount"
POSITION 9
MAX-WIDTH 38
COLUMN-LABEL "Max Amount"
DECIMALS 10
ORDER 140
MANDATORY

After investigation I found out that the numeric format of the session was "european". 

So it seems that dumping a DF does not look at the numeric format, but loading a df is, correct?

All Replies

Posted by Stefan Drissen on 06-Jun-2017 10:26

An initial value with thousands separators?

Posted by e.schutten on 07-Jun-2017 06:33

hmmm, well spotted.

So I did some testing with decimal separators in initial value:

I created a table 'test' with 2 fields. Field 'deTest1' with initial value '9,99' and field 'deTest2' with initial value '9.99'.

This table was created with num-format 'European'.

I then did 'create test' and 'find first test. Display test'.

Result is:

deTest1 = 9,99

deTest2 = 999.00

Then I change the num-format to 'American' and display the record again.

Result is the same, only the separator is different:

deTest1 = 9.99

deTest2 = 999.00

Then I deleted this record and created a new record again with num-format 'American'.

Result is:

deTest1 = 9.99

deTest2 = 999.00 (I would expect deTest1 = 999.00 and deTest2 = 9.99)

Then I change the num-format to 'European' and display the record again.

Result is the same, only the separator is different:

deTest1 = 9,99

deTest2 = 999,00

After these test I change the num-format to 'American' and deleted the table and add the table again with the same fields and the same initial value, so field 'deTest1' with initial value '9,99' and field 'deTest2' with initial value '9.99'.

Then I created a new record.

Result is:

deTest1 = 999.00

deTest2 = 9.99

The result is the other way around when I created the table with num-format is 'european'????

Changing the num-format does not change the value, it only change the decimal separator from '.' to ','.

But it seems that num-format is very important when you create a decimal field with a decimal initial value.

This thread is closed