Hi,
Iam using the following code Numeric validation.
If Oconv(Trim(InputLink.Col),"MCN") = Trim(InputLink.Col) Or Index(InputLink.Col,'E',1) >=1 Or Index(InputLink.Col,'e',1) >=1 Or InputLink.Col <>'' Then InputLink.Col Else 'Error'
Is the right approach?.
TIA
Validation
Moderators: chulett, rschirm, roy
pandu80,
I think your approach is lacking a bit. For instance, the string 'Hello World' would be considered a number, as would any non-empty string (for different reasons).
I don't have a ds system to check right now, but I would use the NUM(<value>) function to start with. If you want a detailed check it is better to do this in a function, that way you can check the STATUS() return code when using ICONV or OCONV to check for different possibilities.
Perhaps you could state exactly what you want to check - with numbers you have integers, real number, floating point and exponential representations - do you want to cater to all of these at the same time?
I think your approach is lacking a bit. For instance, the string 'Hello World' would be considered a number, as would any non-empty string (for different reasons).
I don't have a ds system to check right now, but I would use the NUM(<value>) function to start with. If you want a detailed check it is better to do this in a function, that way you can check the STATUS() return code when using ICONV or OCONV to check for different possibilities.
Perhaps you could state exactly what you want to check - with numbers you have integers, real number, floating point and exponential representations - do you want to cater to all of these at the same time?
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom