View previous topic :: View next topic
|
Author |
Message |
ramco_sita
New User
Joined: 25 Jun 2007 Posts: 40 Location: chennai
|
|
|
|
validation for number field
whether they have entered any spaces???
how to check that in the code.
if they have entered a number and space i have to ignore the space if number has been entered. |
|
Back to top |
|
|
palas_08 Currently Banned New User
Joined: 26 Feb 2007 Posts: 9 Location: kolkatta
|
|
|
|
hi,
check num is numeric or not ?
u can move to x(3)
o1 gr.
02 num pic x(3).
02 num2 redefines num.
03 a occures 3 time pic x(1).
if a(1)=' '
and then u can check .
I think this will help u
with regards
palas |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you can always use the numval function which will return either a number (spaces removed) or an error telling you that there are alpha characters. |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
You can also use the UNSTRING command |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If the user enters "123 45 ", what should happen? |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
As stated by the question, if they enter a space he want to forget
the rest of the data in the field. if the field had bbb150 and the user
enter 275 over the bbb150 the field would look like 250b50 and
with the unstring you end up having just the 275. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
As stated by the question, if they enter a space he want to forget
the rest of the data in the field. if the field had bbb150 and the user
enter 275 over the bbb150 the field would look like 250b50 and
with the unstring you end up having just the 275. |
That is one way to interpret the post. . . . Also, that when numbers are followed by spaces, the spaces should be ignored and the number properly scaled.
Which is why i posted the example with the embedded space. Should the space terminate the field, should the digits be combined into one number, or should it be an error?
We can only guess - any could be correct if the rule so defined. Maybe TS will clarify. . . . |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
That is so TRUE.... |
|
Back to top |
|
|
|