Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Data type for two digit number with 2 decimal places

0 Kudos

Hi all,

I have created a custom database having a field score. I want this field to have values from 0 to 10 with two decimal places. When I created a domain with type decimal, I am not able to enter the value 10. Can anyone help me with this issue o suggest an appropriate data type?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

If you are creating a table maintanence for your table, you can restrict the value by writing the code in EVENTS. You can check whether the values is in range 0 to 10,

Cheers

~Niranjan

13 REPLIES 13

laurent_fournier2
Contributor
0 Kudos

Hi,

Create a data element of type DEC with length 5 decimal places 2. It should work.

Regards.

0 Kudos

Hi Sooraj,

Your issue can be resolved by above post by Fournier. Data type, Length, number of decimal places,output length, letter case, Value range and value table can be set in Domain.

Close this thread if your question is answered.

Thanks,

Prem

0 Kudos

Thanks for the reply.....

Even after giving the value range from 0 to 10, I am able to make entry with a value greater than 10. How to solve this issue?

I gave decimal places 2 and length 5...still no use.....

0 Kudos

Create a domain with type dec length 5 decimals 2 and in the values tab, add a range from 1 to 10.

Then change your data element to use the newly created domain.

Former Member
0 Kudos

Hi,

If you are creating a table maintanence for your table, you can restrict the value by writing the code in EVENTS. You can check whether the values is in range 0 to 10,

Cheers

~Niranjan

0 Kudos

Hi,

Give interval values as upper limit as 10 and lower limit as 0 in value ranges.

regards.

0 Kudos

Hi Laurent/Lingaraj,

I have done the same thing you guys told.....Created a domain with dec type length 5 decimal places 2. In the interval lower limit 0 and upper limit 10. Still I can make an entry > 10.

Niranjan: Is there any other way, without going for TMG?

0 Kudos

Hi again,

The value limit documentation describes :

"

There is only an input check of the mask for data types CHAR and NUMC. Note that the system only checks single values for NUMC.

if a check table and fixed values are defined for a table field, only values that exist in both the check table and in the fixed values can be entered in the field."

So in your case, you must check the value from your program.

Regards.

0 Kudos

An open-sql insert statement will not care for any kind of restriction put on field (foreign key) or domain (value) as long as the value is complient with the internal type definition (num/dec/bin packed/binary, ect.)

- You can have a range [0,9;99] or [-9.99,9.99] but not [0,10] without coding in every program involved.

- The dialog maintenance generator will add some check, but those check must be coded in each of your programs that maintain this field value.

- If this data comes from user input on screen, you could use a conversion-exit to clear invalid values.

- Which kind/number of programs will maintain this value ?

Regards,

Raymond

0 Kudos

Ok..Then I will go with TMG..

Thanks to all...

0 Kudos

Hi all,

There is a filed in my table which is of type RWASTRING.

Because of that I cannot create TMG for this table as i am getting a short dumb whenever I create a TMG.

Now what to do with the above problem we discussed??

Former Member
0 Kudos

Hi,

You can use   QUAN with lenght 4 decimal 2.

Regards,

Venkat.

0 Kudos

Venkat,

Getting an error 'Fixed value definition is not allowed for this data type'...