filtering OR

casanovacasanova Member Posts: 194
edited 2014-01-29 in NAV Three Tier
hi all
any idea how to filter by "OR"?
I have 2 different fields,but i want to filter with the same value

for example : i want to show in page, either field 1 is "A" or field 2 is "A"

how to setfilter that?
thx

Comments

  • ara3nara3n Member Posts: 9,256
    You can't use OR on two fields. You have to set one filter loop through it and store it in temp record and then set the second filter and store that in temp table.
    A second option is to add a new field that has the values of both field A and B and then filter on the third field instead.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • StLiStLi Member Posts: 83
    i found it's a little more performant to use marking instead of a temp record but the basic idea stays the same.
    setrange(field1, 'A');
    if findset then
      repeat
        mark(true);
      until next = 0;
    
    setrange(field1);
    setrangE(field2, 'A');
    if findset then
      repeat
        mark(true);
      until next = 0;
    
    setrange(field2);
    markedonly(true);
    
    now you have your recordset ready for further processing.
Sign In or Register to comment.