SETFILTER Question

Sbhat
Member Posts: 301
Hi Folks -
I have a SETFILTER question.
On the Vendor card i have a field called 'Responsibility center' which has values like NY,ATLANTA,DC,CANADA and some vendors have blank responsibility center, when user opens the vendor card i want to see all vendors that have blank responsibility center plus vendors with responsibility center with NY,ATLANTA and DC. I stored the the 3 responsibility center in a string called
temp := 'NY|ATLANTA|DC'
I then tried vendrec.SETFILTER("responsibility center",'%1&%2',' ',temp) but does not work.
Is there any way to show the blank vendors plus the one in the temp string.
Any help is appreciated !
Thanks
SB.
I have a SETFILTER question.
On the Vendor card i have a field called 'Responsibility center' which has values like NY,ATLANTA,DC,CANADA and some vendors have blank responsibility center, when user opens the vendor card i want to see all vendors that have blank responsibility center plus vendors with responsibility center with NY,ATLANTA and DC. I stored the the 3 responsibility center in a string called
temp := 'NY|ATLANTA|DC'
I then tried vendrec.SETFILTER("responsibility center",'%1&%2',' ',temp) but does not work.
Is there any way to show the blank vendors plus the one in the temp string.
Any help is appreciated !
Thanks
SB.
0
Comments
-
NAV evaluates exactly what you type in.
So you can't have something that is equal to DC, ATLANTA, or NY and also equal to blank at the same time.
You want DC|ATLANTA|NY|''0 -
I tried placing |'' and it still does not work. Any thoughts.0
-
-
Hi,
I think you have want to exclude only canada,it can be like this then :
vendrec.SETFILTER("responsibility center",'<>%1','CANADA);
-
Navin0 -
Sbhat wrote:temp := 'NY|ATLANTA|DC'
I then tried vendrec.SETFILTER("responsibility center",'%1&%2',' ',temp) but does not work.
1. as mattrax said you cannot have something equal to some text AND equal to blank at the same time
2. SETFILTER(field,'%1', string) filters for EXACT string variable content, in your case 'NY|ATLANTA|DC'. The string variable is not interpreted as filter syntax, it is quoted because you have used '%1 in SETFILTER syntax.
In order to make this work as expected you need to use SETFILTER(field, string) syntax.
If you want to add empty Responsibility Centre you should add it to your temp variable, like this:
temp := '''''|NY|ATLANTA|DC'
and use
SETFILTER("responsibility center",temp);
Note one ' string opening character plus four ' characters to include empty string in the filter - NAV will understand this as ''|NY|ATLANTA|DC filter. Use MESSAGE(temp) to test what NAV will see.
Hope this helps,
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
Or you can use this:
temp := 'NY|ATLANTA|DC'
I then tried vendrec.SETFILTER("responsibility center",temp+'|%1',' ');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