Filters

amitaguptaamitagupta Member Posts: 43
Hi All...

Here are the set of questions:

1) If I apply SETRANGE on a field and then again apply SETRANGE for some other value on the same field, what would happen?

2) If I apply SETRANGE on a field and then apply SETFILTER for some other value on the same field, what would happen?

3) If I apply SETFILTER on a field and thena apply SETFILTER for some other value on the same field, what would happen?

4) If I apply SETRANGE on a field and then apply SETRANGE on some other field of the same record set, what would happen?

Thanks.. Have a nice day!

Amita

Comments

  • krikikriki Member, Moderator Posts: 9,112
    [Topic moved from Navision forum to Navision Exams & Certification forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • amitaguptaamitagupta Member Posts: 43
    Why no reply...??? :(
  • KosheKoshe Member Posts: 37
    Hi,
    I think that if You apply 2 filters on the same field, the second one will override the first one.
  • DRBDRB Member Posts: 105
    edited 2007-05-23
    edited........................
    -Dhan Raj Bansal
    Linkedin Profile: http://in.linkedin.com/in/dhanrajbansal
  • abartonicekabartonicek Member Posts: 162
    Koshe wrote:
    Hi,
    I think that if You apply 2 filters on the same field, the second one will override the first one.
    Koshe is right.

    1)When you apply 2 filters on the same field (no matter if you use SETRANGE or SETFILTER), the second one will override the first one.
    So if you use code like this (for table 17)
    SETRANGE("Entry No.",10000,20000);
    SETRANGE("Entry No.",12000,25000);
    
    the result will be 12 000.. 25 000 (the last filter used on that field)
    You can try it by using
    MESSAGE('%1',GETFILTERS);
    
    after setting that filters.

    2) and 3) is same as the 1), you are just using different statements for setting filters

    4)For this case you will get an intersection of filters (like DRB wrote)
    Better to be critical then self-critical :)
  • amitaguptaamitagupta Member Posts: 43
    4)For this case you will get an intersection of filters (like DRB wrote)
    ....

    Could not understand... :-k
  • abartonicekabartonicek Member Posts: 162
    I see DRB has edited his post so I'll write it again.
    If you set filters on two different fields in record set (let say, table 17), as a result, you will get an intersection of those two filters.
    Or more clearly:
    If you use code like this:
    SETRANGE("Entry No.",10000,20000);
    
    then the result are all the entries with number from 10000 to 20000
    If you have code like this:
    SETRANGE("Entry No.",10000,20000);
    SETRANGE&#40;"Posting Date",01012006D,01012007D&#41;;
    
    then the result are all the entries with number from 10000 to 20000 where Posting Date is in last year (01.01.2006-01.01.2007).
    With first filter you are selecting entries based on their Entry No. and with that other filter you are selecting some entries from allready selected range (10000..20000).

    It's like having two fields: Char and Num and table looks like this
    Char Num
    A 1
    A 2
    A 3
    A 4
    B 1
    B 2
    B 3
    B 4
    C 1
    C 2
    C 3
    C 4

    After
    SETRANGE(Char,B);
    
    result is:
    Char Num
    B 1
    B 2
    B 3
    B 4
    and result after
    SETRANGE(Char,B);
    SETRANGE&#40;Num,1,2&#41;;
    
    is:
    Char Num
    B 1
    B 2

    Hope it is a little bit more clear now.
    Better to be critical then self-critical :)
  • amitaguptaamitagupta Member Posts: 43
    Great explanation abartonicek.... =D>
Sign In or Register to comment.