Ticket #29441
Question
Receiving error message on a maintainer that my field only allows a digit not greater than 1. I checked the field in the table and confirmed that its length is 3 and decimal is 2. So it should allow anything with 3 digits length and 2 decimal places. What is the problem?
Answer
The reason you are running into problems is because the column you have defined in the table is a numeric field with a length of 3, and a decimal precision of 2. This means that the field will always write with 2 decimal places, leaving you with only 1 placeholder to the left of the decimal. The decimal precision is factored out of the total length. This is expected behavior when it comes to SQL and numeric defined fields. ex.If you type '3' into the maintainer form, the value written to the database is '3.00'If you type '3.2' into the maintainer form, the value written to the database is '3.20' If you type '32.2' into the maintainer form, the form stops you as this value '32.20' is invalid and exceeds the field length defined in the table. Therefore any number with 2 or more digits to the left of the decimal with fail, because m-Power is safe guarding you from writing a value your database would not accept, or possibly just truncate if it did write. If this table where the field comes from was created through m-Power, you can alter the table from Manage Tables and edit the field to give it a longer field length (ex. maybe (5,2). Once done from a dictionary level, you'll need to recompile the application to pick up on the change as well.
Asked on August 28, 2019