Multi-field filter

FishermanFisherman Member Posts: 456
Sorry for so many new threads guys... I'm a noob here.

I need to know how to set a multi-field filter from code. I've got a bound form, and I know how to use the rec.SetFilter() function call, but I don't see any way to use it on more than on column. Can you do this?

Comments

  • ara3nara3n Member Posts: 9,257
    rec.setfilter(field1,'%1',myvalue);
    rec.setfilter(field2,'%1',myvalue2);
    rec.setfilter(field3,'%1',myvalue3);
    
    
    

    Something like this?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • FishermanFisherman Member Posts: 456
    So the filters maintain previous state? That was my concern - that setting a new filter value would replace the previous filter value....
  • krikikriki Member, Moderator Posts: 9,118
    If you can use SETRANGE, better use it and don't use SETFILTER.
    If you put a SETRANGE (or SETFILTER) on a field and later put another SETRANGE (or SETFILTER) on the SAME field, it will lose the first filter.
    To maintain the previous filter, you have to put it in another FILTERGROUP.

    e.g.
    Record.SETFILTER("Field 1",'ABC*');
    Record.FILTERGROUP(6);
    Record.SETFILTER("Field 1",'*XYZ');
    Record.FILTERGROUP(0);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.