Only by SETFILTER

navuser1navuser1 Member Posts: 1,329
Hi All,

Suppose there is a Table – TestX and its fields are

1. Emp Code (Code)
2. Male (Boolean)
3. Adult (Boolean)


And I want to get data from the table TestX if one of the two fiels Field Male OR Field Adult is true.

Is it possible with the SETFILTER Function Without IF ELSE Function?

Thanks..
Now or Never

Comments

  • kinekine Member Posts: 12,562
    Add 4. field which will be "Male or Adult" and into OnValidate of Male and Adult add code
    "Male or Adult" := Male or Adult;
    

    Than you can filter on this field...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • navuser1navuser1 Member Posts: 1,329
    Thanx for your reply.

    No kine , I cann't add any field.
    I just want to know is it possible ..... with SETFILTER without IF ELSE.

    Because I have found a SETFILTER Syntax where
    SETFILTER contains More that two Table Fields.
    Now or Never
  • kinekine Member Posts: 12,562
    navuser1 wrote:
    Because I have found a SETFILTER Syntax where
    SETFILTER contains More that two Table Fields.

    ??? Where ???

    It is not possible to do it in one loop...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • sanjeevdalelasanjeevdalela Member Posts: 45
    you user

    SETFILTER(Male,'%1',TRUE);
    SETFILTER(Adult,'%1',TRUE);
    Sanjeev Kumar Dalela
    Technical Consultant
    (Dataman Computer Systems P Ltd.)
  • kinekine Member Posts: 12,562
    Yes, but this will filter Male AND Adult, not or... it means BOTH must be true, request is One of them is true... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • navuser1navuser1 Member Posts: 1,329
    kine wrote:
    navuser1 wrote:
    Because I have found a SETFILTER Syntax where
    SETFILTER contains More that two Table Fields.

    ??? Where ???

    It is not possible to do it in one loop...


    selected code

    SETFILTER("Branch1 Code","Branch2 Code","Branch3 Code",'<>%1|<>%2|<>%3',LocationRequest,'');

    "Branch1 Code","Branch2 Code","Branch3 Code", are the table fields
    and LocationRequest is the Variable.
    Now or Never
  • kinekine Member Posts: 12,562
    Did you tried it? No, it is not working in this way... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • navuser1navuser1 Member Posts: 1,329
    kine wrote:
    Did you tried it? No, it is not working in this way... ;-)

    Yes I have tried but it's not working.

    Thnx for your valuable comment and support.
    Now or Never
  • PsixoLogPsixoLog Member Posts: 5
    Hi all!
    To get data from the table if one of the two fields Male OR Adult is true use this:
    RESET;
    IF FINDFIRST THEN
    REPEAT
      IF Adult OR Male THEN
        MARK(TRUE);
    UNTIL NEXT = 0;
    MARKEDONLY(TRUE);
    
    I think, using only SETFILTER it's impossible.
  • kinekine Member Posts: 12,562
    PsixoLog wrote:
    Hi all!
    To get data from the table if one of the two fields Male OR Adult is true use this:
    RESET;
    IF FINDFIRST THEN
    REPEAT
      IF Adult OR Male THEN
        MARK(TRUE);
    UNTIL NEXT = 0;
    MARKEDONLY(TRUE);
    
    I think, using only SETFILTER it's impossible.

    BUT!!! Do not use this solution if you have thousands and millions of records in the table... [-X
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.