on 07-01-2011 3:00 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.