Hello!
How do I have to code the following filter:
IF TableInput.FIND ('-') THEN BEGIN
REPEAT
strFilter := strFilter + Format( TableInput.TableID) + '|';
UNTIL TableInput.NEXT = 0;
END;
SETFILTER("Object ID",'%1',strFilter);
The Filter should filter by Objekt ID which is an integer, of course strFilter is a string with a list of integers linked with |. Navision refuses to do this, what is the correct synthax?
Thanks
0
Comments
Note: with your loop, the variable strFilter ends with a | <- this you must eleminate.
Regards
Look to me as if the filter is build as 1|2|3| the problem is the last |
to remove the last | use
strFilter := copystr( strfilter, 1, strlen(strfilter) -1 );
How this helps
PS Welcome to Mibuso
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
Dam it - Beaten again #-o - you Germany are far too efficent
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
the thierd parameter, the value, must have the same datatype like the field which is filtered. The filtered field is from type integer. But the value is text so the compiler would tell this.
To solved this, you can put your filterconsturct into the second parameter. Instead of
you can also write
but not
the second problem in this code is, see in the first post, that the variable strFilter ends with a | <- the last pipe must be eleminated
regards
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
1st problem there might be only one record, so we have to code for this.
2nd the Pipe "|" has to come before the the string, but not for the First Record, so we add a counter, and change the string based on its value.
Hope this helps!
David
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
is that possible to filter...constructing a string as the previous... but with <> (not equal ) from a list?
SETRANGE("Purch.Order Line No.", '<>%1', myString) ?
with my String = 'A|B|C...'
Or which is the right syntax?
myString = '<>A|<>B|<>C ...'
Thank you
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog