Prevent use of filter characters in No. field
colingbradley
Member Posts: 162
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
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
Experience is what you get when you hoped to get money
0
Comments
-
You can clean the entry up .. like this.
TempText := DELCHR(TempText,'=','-_+=\|[]}{".,#$@%^&*+!~`:;/?><');
or fill in the ValuesAllowed property of the field with only the characters you want 1,2,3,4,5,6,7,8,9,0,A,B,C,D....ETC. This will pop a message if a non listed character is entered.
Or use a similar code as above but opposite. DELCHR all the characters you want and if the result is not blank then ERROR.0 -
(My help text says use the semicolon).
The Values Allowed does not work that way as far as I can tell, I have:
0;1;2;3;4;5;6;7;8;9;A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;1234
But trying to enter a No. of 1A gives an error saying that is not allowed. 1234 IS allowed.
Presumably you would have to have every possible combination set up?
Ideally, I would like to get any reserved characters and display them in the error message.Experience is what you get when you hoped to get money0 -
CharAllowed works.
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
That does it for me, the message is automatic if any other character is used.Experience is what you get when you hoped to get money0 -
colingbradley wrote:(My help text says use the semicolon).
The Values Allowed does not work that way as far as I can tell, I have:
0;1;2;3;4;5;6;7;8;9;A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;1234
But trying to enter a No. of 1A gives an error saying that is not allowed. 1234 IS allowed.
Presumably you would have to have every possible combination set up?
Ideally, I would like to get any reserved characters and display them in the error message.
I think the string needs to be:azAZ09
David Singleton0 -
Oh and if you want to do it in code, then you can use Harry's example like this:
If "No." <> DELCHR("No.",'=','-_+=\|[]}{".,#$@%^&*+!~`:;/?><') THEN error('-_+=\|[]}{".,#$@%^&*+!~`:;/?>< are not allowed');
(though the \ probably wont show in the message but you can play with that.)David Singleton0 -
David Singleton wrote:Oh and if you want to do it in code, then you can use Harry's example like this:
If "No." <> DELCHR("No.",'=','-_+=\|[]}{".,#$@%^&*+!~`:;/?><') THEN error('-_+=\|[]}{".,#$@%^&*+!~`:;/?>< are not allowed');
(though the \ probably wont show in the message but you can play with that.)
The CharAllowed error message does show the \ so seems to be a good option but thanks David for you excellent response as always.Experience is what you get when you hoped to get money0 -
Ooops Values Allowed - I ment CharAllowed :oops:0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
