cancel
Showing results for 
Search instead for 
Did you mean: 

Control an Integer field Length without using Validation ??

former_member283645
Participant
0 Kudos

Hi,

I have Couple of fields where I need to configure them as Integers.

Now each one has a fixed length that i need to limit to.

But when i create a field of type: integer, i cannot select teh length!!!

To achive this the idea i have is to write a validation which checks length..

But can i achive it without going for a validation on each field???

PS: I am aware that TEXT field can limit the length But it also allows me to enter text values, my requirement clearly says that to allow users to only enter Numeric values..

Did anyone face a similar Case?

Kind Regards

Eva

Accepted Solutions (1)

Accepted Solutions (1)

former_member205403
Active Contributor
0 Kudos

Hi Eva,

I didn't try in the system, but I feel there are two solutions to achieve your requirement (*of course in both cases you will need to write a simple validation)

Solution 1 : When field is defined as "Integer" in Console.

lets take an example, you want to restrict an integer field with a limit of max 4 characters.

Maximum value of a 4 character integer can be "9999". So, you can put a simple validation to compare the field value with 9999. if the value is less then this means fields values is less than 4 characters, else more than 5 characters.

In this case Your validation expression in expression editor will be:

FIELD NAME<= "9999"

Solution 2 : When field is defined as "Text" in Console.

In this case you can restrict the maximum field length through Console. But you will also need to write a validation to ensure that user is not entering any alphabets or special characters in this field.

In this Case you can use below validation:

HAS_ALL_CHARS(FIELD NAME, "0","9")

This will ensure that field has all characters between 0 and 9 and doesn't hold any special character or alphabets.

In Both cases you will need to set "Automatic Execution" property as "Error". Also please do not manually type any function or value in expression editor. use drop down for fields, operators, functions etc. and enter numeric values using the first blank box before dimension list.

Kindly revert if you face any issues.

-Shiv

former_member283645
Participant
0 Kudos

Hi,

Thanks for the responses

That Worked.

Kind Regards

Eva

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Eva,

I guess we can use Length function in expression editor while writing validation for this field.

If it doesnt work for integers then as suggested by Shiv writing a validation to restrict values from 0 to 9 using Has_All function,and length restriction can be imposed along with this Validation.

len(FieldName) < 6 (say)

Hope this helps!

Thanks,

Ravi