multiple setfilter using MARK !!

pskannaapskannaa Member Posts: 138
I need to use two different filter for getting record in LIST form

filter1 ->for matching Myfield1
filter2 -> for matching Myfield2

get the matching records from the both filters like OR operation in filter condition.

rec.setfilter("Myfield1",value);
IF Rec.FIND('-') THEN
REPEAT
Rec.MARK(TRUE);
UNTIL Rec.NEXT = 0;

rec.setfilter("Myfield2",value);
IF Rec.FIND('-') THEN
REPEAT
Rec.MARK(NOT Rec.MARK);
UNTIL Rec.NEXT = 0;

Rec.MARKEDONLY(TRUE);

Unable to get the proper records in the list, missing somewhere !!!!
Solution Plz..

Regards,
Psk

Comments

  • kapamaroukapamarou Member Posts: 1,152
    Before rec.setfilter("Myfield2",value);

    do either rec.SETRANGE("Myfield1") or RESET to remove your first filter.
  • pskannaapskannaa Member Posts: 138
    added the code (Rec.SETRANGE(fld1)) after the first condition.....showing no record.

    next added the code (Rec.SETRANGE(fld2);Rec.MARKEDONLY(TRUE)) after the second condition...showing only FIRST condition records, second one not taking the place...

    What is wrong ???
  • kapamaroukapamarou Member Posts: 1,152
    Sorry... Forget about the RESET command because it will clear your marks.


    The idea to get the OR-like filter is something like:

    rec.SETRANGE(field1,value);
    IF rec.FIND('-') THEN REPEAT
    rec.MARK(TRUE);
    UNTIL rec.NEXT = 0;

    rec.SETRANGE(field1);// <-- Removes the filter on field1

    rec.SETRANGE(field2,value);
    IF rec.FIND('-') THEN REPEAT
    rec.MARK(TRUE); // <- Just a mark. If the record is marked it remains marked. If it isn't it gets marked.
    UNTIL rec.NEXT = 0;

    rec.MARKEDONLY(TRUE);
  • pskannaapskannaa Member Posts: 138
    Good....it's Working!! :D
Sign In or Register to comment.