Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

SetFilter

(0) ShareShare
ReportReport
Posted on by 3,027

Hi



ILE[2].SETRANGE("Posting Date",StartDate,EndDate);
ILE[2].SETFILTER(ILE[2]."Entry Type",'%1|%2',ILE[2]."Entry Type"::Consumption,ILE[2]."Consumption Type"::Rev);
ILE[2].SETFILTER(Quantity,'>%1',0);
IF ILE[2].FINDFIRST THEN REPEAT
  Qty[2] += ILE[2].Quantity;
  MESSAGE('%1',ILE[2]."Entry Type");
 UNTIL ILE[2].NEXT=0;

In message it is displaying +ve Adjustment , whereas i have filtered records on Entry Type "Consumption

Thanks

*This post is locked for comments

  • Verified answer
    Rafael B. Profile Picture
    Rafael B. 715 on at
    RE: SetFilter

    Hi

    Take a look at this line:

    ILE[2].SETFILTER(ILE[2]."Entry Type",'%1|%2',ILE[2]."Entry Type"::Consumption,ILE[2]."Consumption Type"::Rev);

    You filter "Entry Type" field by option value from "Entry type" field (that's ok) and by option value from "Consumption Type" field (that's a mistake).

  • jsshivalik Profile Picture
    jsshivalik 3,027 on at
    RE: SetFilter

    Hi

     Can u pls tell me what is wrong in that Code.

    Thanks

  • jsshivalik Profile Picture
    jsshivalik 3,027 on at
    RE: SetFilter

    Hi

      That's ok.  But i want with Quantity  > 0 & also Entry Type should be Consumption or Rev

    Thanks

  • ManishS Profile Picture
    ManishS 78 on at
    RE: SetFilter

    ILE[2].SETFILTER(Quantity,'>%1',0); here you are filtering quantity greater than zero.

  • Verified answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: SetFilter

    TRY this.

    ILE[2].SETRANGE("Posting Date",StartDate,EndDate);

    ILE[2].SETFILTER(ILE[2]."Entry Type",'%1',ILE[2]."Entry Type"::Consumption);

    ILE[2].SETFILTER(ILE[2]."Consumption Type",ILE[2]."Consumption Type"::Rev);

    ILE[2].SETFILTER(Quantity,'>%1',0);

    IF ILE[2].FINDFIRST THEN REPEAT

      Qty[2] += ILE[2].Quantity;

      MESSAGE('%1',ILE[2]."Entry Type");

     UNTIL ILE[2].NEXT=0;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans