Applying the SETFILTER using a Wildcard filter against a value from another field does not work.
For example if the OtherFieldValue is another field from a different table and you need to filter a text field for names begining with the letter 'G'
You would expect the SETFILTER to return only records begining with 'G'
OtherFieldValue := 'G';
SETFILTER(name,'%1*',OtherFieldValue);
This does not work
A way around this is to use the STRSUBSTNO to include the WILDCARD
SETFILTER(name,'%1',STRSUBSTNO('%1*',OtherFieldValue));
0
Comments
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
5.0fdb not working...
4.0sp1 sql working...
3.70 sql working...so.......................
only in version 3.70 and above, for sql DBs only, filters like <>A* works!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
I am using Nav. 4.0 SP2 SQL DB.
I am having a problem with using setfilter with *
SETFILTER(Field,'%1',STRSUBSTNO('%1*',TEXTVALUE));
OR
SETFILTER(Field,'%1*',TEXTVALUE);
I am having an error message:
The Filter cannot have question mark(?),asterisk(*), or 'at' sign (@)
thanks,
archaingels
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
"Kine" wrote the lines above in the topic below, I hope it will definitively complete this "tips & trick" topic
I Wrote:
I was talking about inserting filters within the mask (user's side - F7).
In C/AL code you must handle wildcards in the way written in the link below. Hope this helps!
http://www.mibuso.com/forum/viewtopic.php?t=23219&highlight=
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
I'm using Navision financial 2.65.
I'm trying to search for this string in the database:
@ahoo.com
.SETFILTER(Email,'%1','@ahoo.com'); -> not working (couse: @ - special char)
.SETFILTER(Email,'%1','*ahoo.com'); -> not working (couse: dont give back the exact result)
Are there any "ESCAPE" character in Navision I can use.
Thanks for the help.
not SQL database....
or also
SETFILTER(Email,'%1','?ahoo.com');
the SETRANGE is generally better for performance.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I suppose he wants *@ahoo.com...
BTW...meehi, did you try with the find/replace(or replace all) feature with @ahoo.com keyword?
oh! damn it!this topic is double posted in navision too!
edit: not really...only the question is duplicated
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
continue this here:
http://www.mibuso.com/forum/viewtopic.php?p=125500#125500
IF "Item"."No." = '*' + 'PIP' + '*' THEN CurrReport.SKIP; but it didn't seem to work. Can someone give me a hint!?
anyway...in a sql db 4.01 it works
also: the code you wrote is wrong with this code you skip THE item named *PIP*...in other words...you're not setting a filter with this code!!
the correct code to achieve your goal is this (use it only if the filter does not work, as it is slow)
see the online help for strpos function
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog