How to Setfilter <>''

mspellmanmspellman Member Posts: 6
I'm trying to set a filter for records where the field is not ''. I have tried SETFILTER(field,'<>%1','') and this does not return any records. Is there a way to do this?

TIA,
Mike

Comments

  • IHateLinuxIHateLinux Member Posts: 223
    Hi,

    can you try to use
    SETFILTER(field,'<>%1','''''')
    in your code:
    The first is for starting the text, the second one to mask the third one, the forth to mask number 5 and the 6th and last one to close the string.

    HTH,
    Rainer
  • kinekine Member Posts: 12,562
    Sorry, but easiest is
    SETFILTER(field,'<>%1','') 
    

    if you use the format IHateLinux wrote, you will filter for all values different from "two apostrophes" value. This syntax can be used only if it is part of the second parameter for the SETFILTER - it means when you use something like
    SETFILTER(field,'<>''''''') 
    
    than it can work... but this is not good example....
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • mspellmanmspellman Member Posts: 6
    I tried both
    SETFILTER(field, '<>%1',' ')
    
    and
    SETFILTER(field, '<>%1,'''''')
    

    Neither one is accomplishing what I want. I'm trying to filter for records with any value in the field. I want to filter out NULL('') values. Any other ideas?

    Thanks,
    Mike
  • i4tosti4tost Member Posts: 208
    Actually code SETFILTER(field,'<>%1','') should work because it works :)
    You missing these records or something else.
  • BeliasBelias Member Posts: 2,998
    SETFILTER(field, '<>%1',' ')

    you really inserted a space between quotemarks?if so, toggle it.
    otherwise, are you filtering the same variable you're showing/processing?

    also, try debug, view the filters on the record variable before and after the instruction above
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • kinekine Member Posts: 12,562
    The space between the apostrophes is your problem... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • bbrownbbrown Member Posts: 3,268
    Be careful with using "not equal to" filters. These can cause performance issues with larger tables as they will result in table/index scans.
    There are no bugs - only undocumented features.
  • mspellmanmspellman Member Posts: 6
    Thanks for the help.

    Apparently I had it right the first time (without the space between the apostophes).

    There was a typo in my other filter statement :oops:

    Thanks again!
Sign In or Register to comment.