View previous topic :: View next topic |
Author |
Message |
sat Beginner
Joined: 23 Jan 2006 Posts: 8 Topics: 3
|
Posted: Thu Feb 16, 2006 11:37 am Post subject: Capturing an invalid range of data in panels |
|
|
Hi,
I have a clist panel variable, &memberno. The field is 5 character length. Any 5 length character value is acceptable in this field except the following range: A0001 thru A9999.
That is, any values between A0001 and A9999 is invalid and I want to throw a message. For example: if user inputs A12345, then the input is invalid. But if user inputs, AA001, then the input is valid and want to continue processing. The invalid range is just A0001 thru A9999. How can I capture this in my clist panel.
Thanks |
|
Back to top |
|
|
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Thu Feb 16, 2006 12:49 pm Post subject: |
|
|
You can use the panel statement VER, with the PICT keyword. The VER statement is documented in the fine manual.
Another option is to use a panel exit.
O.
________
Ferrari 333 SP
Last edited by ofer71 on Sat Feb 05, 2011 11:33 am; edited 1 time in total |
|
Back to top |
|
|
danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Thu Feb 16, 2006 5:02 pm Post subject: |
|
|
Try this:
Code: |
/* Value must be 5 characters consisted of A-Z and 0-9 (MSGX010) */
/* not between A0001 and A9999 (MSGX011) */
IF (VER(&MEMBERNO,LEN,NE,5))
.MSG = MSGX010
ELSE IF (VER(&MEMBERNO,INCLUDE,ALPHAB,NUM))
IF (&MEMBERNO >= A0001 AND &MEMBERNO <= A9999)
.MSG = MSGX011
ELSE .MSG = MSGX010
|
|
|
Back to top |
|
|
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Fri Feb 17, 2006 1:34 am Post subject: |
|
|
One thing to remember about panel logic: The IF statement is indentation sensitive; That is - Your ELSE must be in the same column of the related IF.
O.
________
Honda Pacific Coast specifications
Last edited by ofer71 on Sat Feb 05, 2011 11:33 am; edited 1 time in total |
|
Back to top |
|
|
Mervyn Moderator
Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Fri Feb 17, 2006 4:17 am Post subject: |
|
|
Danm, how does your code handle something like "A1BBB"? _________________ The day you stop learning the dinosaur becomes extinct |
|
Back to top |
|
|
danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Fri Feb 17, 2006 10:08 am Post subject: |
|
|
Mervyn,
It displays MSGX011 (Invalid Range) since A1BBB is between 'A0001' and 'A9999'.
Code: |
IF (&MEMBERNO >= A0001 AND &MEMBERNO <= A9999)
.MSG = MSGX011
|
|
|
Back to top |
|
|
Mervyn Moderator
Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Fri Feb 17, 2006 10:38 am Post subject: |
|
|
Yes, but it does look as though sat expects the invalid values to be numeric after the initial "A". _________________ The day you stop learning the dinosaur becomes extinct |
|
Back to top |
|
|
danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Fri Feb 17, 2006 11:56 am Post subject: |
|
|
Mervyn,
Not sure exactly what you mean. It says:
Quote: |
Any 5 length character value is acceptable in this field except the following range: A0001 thru A9999.
|
What message do you want to see for "A1BBB"? |
|
Back to top |
|
|
Mervyn Moderator
Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Fri Feb 17, 2006 4:10 pm Post subject: |
|
|
Well, we won't know unless sat puts us right, but it does look as though the invalid values would be numeric in bytes 2-5, so "A1BBB" would be valid. I agree totally that "A1BBB" is actually in the range "A0001" to "A9999". _________________ The day you stop learning the dinosaur becomes extinct |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Fri Feb 17, 2006 11:58 pm Post subject: |
|
|
Quote: | if user inputs A12345, then the input is invalid. But if user inputs, AA001, then the input is valid and want to continue processing. The invalid range is just A0001 thru A9999. |
The statement implies A9999 (1st char =a and 9999 numerics) is not allowed: Code: | )BODY
+
% Something_VAL +
+
+ P:'&P'
+
)PROC
&P = TRUNC (&VAL,1)
IF (&P = 'A'and VER(&VAL,NB,PICT,A9999)) .MSG = XXX001
)END |
or more crypticly: Code: | )BODY
+
% Something_VAL +
+
)PROC
IF (VER(&VAL,PICTCN,'/', 'A////','A9999')) .MSG = XXX001
)END |
|
|
Back to top |
|
|
sat Beginner
Joined: 23 Jan 2006 Posts: 8 Topics: 3
|
Posted: Mon Feb 20, 2006 2:54 pm Post subject: |
|
|
Sorry, I forgot this over the weekend while I was enjoying my flight to Florida. Man, Florida is quite nice
Okay, your posts have really helped me...there are some changes to the requirement, but it is not finalized...I am working through it.
Now for 'A1BBB', it is a valid input and it should not throw the message. Only the values from A0001 thru A9999 is invalid.
Thanks,
sat! |
|
Back to top |
|
|
|
|