2007 Aug 12 8:22 PM
want to do some validation for telephone number for the pattern XXX-XXX-XXXX
i want to check all the values in the field telephone are numbers.
please help me how to check is there any easy way?
i have done like this
If telnum3(1) eq '-' and telnum6(1) eq '-' .
IF TELNUM CO '0123456789'
phone number is valid
else.
phone number is wrong.
endif.
else.
phone number pattern is wrong
endif.
but when i validate with database value 123-456-7890 giving phone number is wrong.but the pattern is correct .
In one more condition for another field i need to check for only 10 numbers are present
I gave like
l_fax co '0123456789' .
even l_fax contains numbers i am not getting output exactly..
please hellp with how to use Contains Only with the solution to the above problem.
want to do some validation for telephone number for the pattern XXX-XXX-XXXX
i want to check all the values in the field telephone are numbers.
please help me how to check is there any easy way?
i have done like this
If telnum3(1) eq '-' and telnum6(1) eq '-' .
IF TELNUM CO '0123456789'
phone number is valid
else.
phone number is wrong.
endif.
else.
phone number pattern is wrong
endif.
but when i validate with database value 123-456-7890 giving phone number is wrong.but the pattern is correct .
In one more condition for another field i need to check for only 10 numbers are present
I gave like
l_fax co '0123456789' .
even l_fax contains numbers i am not getting output exactly..
please hellp with how to use Contains Only with the solution to the above problem.
2007 Aug 12 8:33 PM
Hi,
Check this
parameters : val(30) type c.
data : final(30) type c,
cnt type i,
v type c,
n type i.
cnt = strlen( val ).
do cnt times.
move val+n(1) to v.
if v ca '0123456789'.
move v to final+n(1).
endif.
n = n + 1.
enddo.
condense final no-gaps.
write:/ final
aRs
2007 Aug 12 9:03 PM
hi gokul
try giving
IF TELNUM CO '0123456789-'
instead of
IF TELNUM CO '0123456789'
hope it solves the problem
Regards
Gaurav
<b>
Reward points for useful answers</b>
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |