Setfilter with ''

madsh
madsh Member Posts: 16
Hi u guys

I’m making a report where I’m trying to set a filter on ”item no.” like this
SETFILTER("Item No.",'%1','');

But I can’t get the same result ass when I use the reqFilterFields
    Field: Item No. Filter: ''

Any one having a idea, what to do when I want to set '' as a filter in the code and not by the request form? :-k

Comments

  • Kowa
    Kowa Member Posts: 927
    SETFILTER("Item No.",'%1','''');
    
    Kai Kowalewski
  • Torben_R.
    Torben_R. Member Posts: 99
    Don't use SETFILTER in this situation - use SETRANGE
    Table.SETRANGE(Field,'');
    
  • costas
    costas Member Posts: 27
    try this
    setfilter("item no.",'=%1','')
    
  • Kowa
    Kowa Member Posts: 927
    All solutions will do, but Torben is right that you should only use SETFILTER when SETRANGE does not do the job. If you need to combine the '' Filter with another filter or want to filter <>'', then use SETFILTER, otherwise SETRANGE.
    Kai Kowalewski
  • madsh
    madsh Member Posts: 16
    Thanks a lot u guys =D>

    The problem seemed to be I had placed my code at the trigger “Report – OnpreReport()” but as I moved it to the trigger “DataItem name – OnPreDataItem()” it solved the problem, actually all yours suggestion worked out fine as Kowa says :oops: .

    Now I can’t figure if it is an advantage that I use the “Item No.” in the key at the DataItemTableView at the “DataItem” or not. Because now I’m setting the filter at the trigger after I’ve made the filter on the Reqform…

    Any one who has an advice for this? :-k