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.
0
Comments
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|''
My Blog - nav.education
My Blog - nav.education
I think you have want to exclude only canada,it can be like this then :
vendrec.SETFILTER("responsibility center",'<>%1','CANADA);
-
Navin
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,
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
temp := 'NY|ATLANTA|DC'
I then tried vendrec.SETFILTER("responsibility center",temp+'|%1',' ');
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.