Filter error with Nav web service but not classic client

NavMTL
Member Posts: 9
I'm trying to call a codeunit that has the following filter
grecCustLedgEntry.SETFILTER("No.",'%1',"CLE No."+'*');
the field grecCustLedgEntry."No." has a max length of 20 characters, when the value of "CLE No." is 20 characters long the web service throws an error "The maximum length for a string value is 20.". I think that the wildcard * that I'm adding at the end of the filter is being considered in the total length. I've tested the same code from classic client and it works fine.
Has anyone come across this issue?
grecCustLedgEntry.SETFILTER("No.",'%1',"CLE No."+'*');
the field grecCustLedgEntry."No." has a max length of 20 characters, when the value of "CLE No." is 20 characters long the web service throws an error "The maximum length for a string value is 20.". I think that the wildcard * that I'm adding at the end of the filter is being considered in the total length. I've tested the same code from classic client and it works fine.
Has anyone come across this issue?
0
Comments
-
Hello NavMTL,
if you want to apply filter of more than 20 character using special character like '*','|' then donot use %1. You should create String filter first then you should apply filter directly as shown below:
Filterstring := "CLE No."+'*';
grecCustLedgEntry.SETFILTER("No.",Filterstring);
If Tips is useful and solved problem then please donot forget to mark it as solved.0 -
Thanks for the reply dipakpatel2505,
I already found a way to work around the issue by doing grecCustLedgEntry.SETFILTER("No.",'%1',copystr("CLE No."+'*',1,20)); but I guess what I was looking for is if there's a hot fix for this as this issue seems to be a glitch in the Web services, as stated in my initial post the code works fine in classic client. My goal is not to have to go through all the code to try and find filters that could potentially have the same issue.0 -
Actually in my opinion the bug is in the Classic Client. If the length of the field is 20, it should not accept a filter string that is longer than 20 characters.
Taking care of string lengths in your code is always a good idea by the way.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K 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
- 320 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