SETFILTER problem

garychick
Member Posts: 34
Hi ALL,
I have an error when I used SETFILTER:
DO anyone know how to solve it?
Thanks!
I have an error when I used SETFILTER:
Item.SETFILTER(Item.Description, '70-HK-(W1)');
DO anyone know how to solve it?
Thanks!
0
Comments
-
Dear Gary,
I Don't know what version of Navision you are using or where exactly you have written this code or what error message you have received.
Still, I think you have made a fundamental mistake in the syntax of your code.
The syntax should be:
Item.SETFILTER(Description, '70-HK-(W1)');
Check it out. It might help.0 -
what's the error?Andre Fidalgo
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com0 -
I think the issue is related to the '('. I found that it is not possible to put a '(' ot ')' in the filter.
Does anyone know why?0 -
Hi,
I think the ')' in your Item Description is being taken as the end of the syntax of the setfilter function.
That's why the error is occurring. I am not sure.0 -
That's impossible, it's between ' ' so it's text. The problem is when applying the filter. You can't use '(' or ')'Andre Fidalgo
My world: Dynamics NAV,SQL and .NET
CEO at Solving Dynamics
http://www.solvingdynamics.com0 -
Hi Gary,
Maybe u can try to use coding below:Item.SETFILTER(Item.Description,'%1' '70-HK-(W1)');
Thank you,
Kok Keong0 -
Sorry Gary,
The previous coding got problems. u just ignore it.
Below is the correct codingItem.SETFILTER(Item.Description,'%1','70-HK-(W1)');
0 -
Hi bestianhow,
It works!
Thanks!0 -
Second and more used is
Item.SETRANGE(Description,'70-HK-(W1)');
0 -
I always do:
Item.SETRANGE(Description,'=%1','70-HK-(W1)');
Makes me think about what exactly I need to do. So in this case I want to set an 'equal' filter, so I explicitly set it like that. Never failed me once.0 -
But....
Are you actually setting that filter? Or are you setting a filter usering a variable that could contain that value?
Never code "hard" filters like that... right?"Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
No of course not, you usually pass a parameter into the code. If I can help it at all I don't hard code filters.
So, the actual code would be like:Item.SETRANGE(Description,'=%1',FilterValue);
Where FilterValue is a variable with the filter criteria in it.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