Special Characters in Filter String
jimmyf
Member Posts: 104
Is it possible to include special characters, e.g. * or & in a filter string?
Some Customer and Vendor names have these characters and I cannot find them when doing a SETRANGE or SETFILTER in C/AL.
CustNameFilter := '@' + CustName;
recCust.INIT;
recCust.SETFILTER(recCust.Name,CustNameFilter);
Thanks
Some Customer and Vendor names have these characters and I cannot find them when doing a SETRANGE or SETFILTER in C/AL.
CustNameFilter := '@' + CustName;
recCust.INIT;
recCust.SETFILTER(recCust.Name,CustNameFilter);
Thanks
0
Comments
-
Some tricks:
use SETRANGE. In this case the string is taken as is.
If you use SETFILTER, best is to replace those chars with '?' which means any character. So it is not perfect, but better I didn't find.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
See the following two posts:
Error"The filter "Cert(A)"is not valid.Did not expect a '('"
Filtering question
Note: The @ needs to go to the value parameter, not the FilterString.CustNameFilter := '@' + CustName; recCust.INIT; recCust.SETFILTER(recCust.Name,'%1',CustNameFilter);
0 -
Hi there
Thanks for replying. I coukd not get the SETRANGE to work however replacing the & and * characters with a ? character and using SETFILTER worked perfectly.
Thanks0 -
SETRANGE would solve your problem with & and *, but does not treat @ as case insensitive indicator, but treats this character literally too.jimmyf wrote:I coukd not get the SETRANGE to work
Did you try my suggestion of using %1 and value parameters with SETFILTER? It has the advantage of being simpler to implement and not creating ambiguities.0 -
Hi there
yes I used your suggestion and it worked perfectly.
Thanks for your help
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 326 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
