I have a little problem to solve out.
I have a field to validate for a time period. The field should accept only ‘M’ which denotes month of a year.
It should not accept ‘Y’, ‘D’, etc.
The format should be as follows: 12M. It should have a numeric field before the ‘M’.
Feel free to post your comments
This may sound like it has nothing to do with your post, but it does. Check out the Mail (or SMTP Mail) codeunit, can’t remember which one. There is a function that verifies email addresses. Basically it looks for an @ sign and a period.
You’ll want a for loop to loop through each character of the string. Then you’ll need to examine each character to make sure it is what you expect it to be. You may want to be careful, because technically 1M + 2M should also be a valid entry.
Of course if you want to go the super lazy way…IF (Input <> ‘1M’) AND (Input <> ‘2M’) …AND (Input <> ‘12M’) THEN…but even then, I think 13M should still be valid.