Prevent use of filter characters in No. field

I have a client who has used the & character in the customer No. field and need to prevent them doing so in future.

As they enter the No., I need to test the No. and if I find any reserved filter characters, issue a warning or ERROR(msg);

What is the best way to search for these characters (% + - | = … ? @ <> *)?

TIA,

Colin

CharAllowed in the properties does the job.

0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

Any other character than those shown will give the user an automatic error.

Excellent.

Note that none of the lower case letters abcdefghijklmnopqrstuvwxyz are allowed values for a Code type field.

That’s a pretty good solution, brilliant! [:D]

I was not sure if needed, if the user enters lowecase, is the test done first or the convert to uppercase?

Did not hurt to put them in but i take your point.

Thanks,

Colin

NAV converts them to uppercase before it’s entered into the database, and that is after the check for allowed characters so I don’t think it’s a problem. I just think the allowed characters should not allow lower case.

Removing the lowercase characters is not good. If the user enters lowercase in the normal way, the system first checks the allowed characters and then converts to uppercase, I just checked.

When I train users, I tell them not to be concerned about using uppercase as the system will take care of it, same for code fields and the Post Code for example. It makes for faster data entry.

It seems the simple thing is to “allow” the entry of lowercase characters just to keep the status quo.

Not better, but simpler: azAZ09

That’s what I said:

It’s not a problem, and your way is one of many perfectly valid ways, I just don’t agree with it [:)]

I would do it differently, because in different countries different special letters are used. I would write code into OnValidate trigger:

IF DELCHR(“No.”,’=’,DELCHR(“No.”,’=’,’*$&|’’’)) <> ‘’ THEN ERROR(…)

Then you can simply list all characters which you don’t allow. In my example they are * $ & | ’

Another perfectly valid way of doing it [:D]

Havent I seen that before somewhere [H]

I have to agree that the exclusion is a better way, as already said, each country has different characters they need excluding.

I then remembered my training and put the characters to be excluded in the hands of the data owner rather than hard coded.

GLSetup.GET();
IF DELCHR(“No.”,’=’,DELCHR(“No.”,’=’,GLSetup.“Reserved Characters”)) <> ‘’ THEN
ERROR(Text001,FORMAT(“No.”),FORMAT(GLSetup.“Reserved Characters”))

Now each company (Country) can determine what is and what is not a reserved character.

Still, it was an interesting excercise exploring the alternatve methods and I now know more about the whole subject, so thanks all.

[Y] excelent solution.