web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

SetRange

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

  In the below Code how SetFilter works. Do i need to define SLine as Array or it will work perfectly.


Sale Invoice Line - OnAfterGetRecord()
Qty := 0;

SILine.SETFILTER("Document No.",'%1',"No.");
SILine.SETFILTER(SILine."Posting Date" , '<%1' , AsDate);
IF SILine.FINDFIRST THEN REPEAT
  Qty += SILine.Quantity;
 UNTIL SILine.NEXT=0;

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    You need to define SILine as local or global variable. Array concept is different and no need here.

  • Tina Menezes Profile Picture
    2,582 on at

    Hi,

    SlLine will be a global or local variable of type-record (table name).

  • Community Member Profile Picture
    on at

    ....except that in this example you are filtering the field Document No. in the SILine-variable that you have created on the field No. in the Sales Invoice  Line itself (which stands for the Item No., G/L: account No., Resource No,).

  • jsshivalik Profile Picture
    3,099 on at

    Hi

       ok. Can u please tell me in my case how SetFilter will work. I have defined it as Global

    Thanks

  • Suggested answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    what do you mean by how setfilter will work?

  • Verified answer
    Tina Menezes Profile Picture
    2,582 on at

    Hi,

    1. SILine.SETFILTER("Document No.",'%1',"No.");

    The above line basically filters out and selects those records where the 'Document no' of sales invoice line is equal to the 'No' of your next table which I assume is your header table.

    2. SILine.SETFILTER(SILine."Posting Date" , '<%1' , AsDate);

    Here Setfilter filters out and selects those records where the sales invoice line 'Posting date' is less than your field 'AsDate'.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans