Filtering out Operator characters

sarkie83sarkie83 Member Posts: 22
edited 2010-06-04 in Navision Financials
We have got some instances where Item No's contain the equals (=) character.
And I always seem to get an error when trying to filter it out:
recItem.RESET;
recItem.SETFILTER("Last Date Modified",'<%1',RefDate);
recItem.SETFILTER("No.",'<>*%1*','=');
IF recItem.FINDFIRST THEN REPEAT
...
...


I can do table filters ok on forms, etc...

Thanks

Answers

  • BeliasBelias Member Posts: 2,998
    I don't know what type of error you can get, but...
    1. filters like <>*something* does not always work (it depends on nav version and if SQL or not)
    2. (the most important) '=' is a wildcard, it's not good to have it in your fields, especially in such an important field like the item no.
    the solution of your problem CAN be to loop the resulting recordset before th <>*=* filter, and check with strpos function if the item code contains '=', then mark the record or populate a temptable...
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • crisnicolascrisnicolas Member Posts: 177
    Belias wrote:
    2. (the most important) '=' is a wildcard, it's not good to have it in your fields, especially in such an important field like the item no.
    the solution of your problem CAN be to loop the resulting recordset before th <>*=* filter, and check with strpos function if the item code contains '=', then mark the record or populate a temptable...

    If you could rename those items so that No. do not contain that kind of characters... that'd be way much easier.

    That happen to me with a Vendor No. containing character & (M&C, i think the vendor No. was)
    When filtering for that specific vendor, Navision didn't understand I wanted to filter per 'M&C' as a whole, Navision actually looked for a vendor who's No. was M and C at the same time.
    I renamed it and, of course, solved the problem.

    Waaay much easier than having to populate a temptable every single time an user filters on that field....
  • sarkie83sarkie83 Member Posts: 22
    Thanks for your replies - I agree that this character should not be appearing in the No. field anyway - so those instances that have appeared I have deleted, and ammended the responsible dataport to trap for anymore...
Sign In or Register to comment.