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

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Getting first 2 lines of sales order

(0) ShareShare
ReportReport
Posted on by

I am putting this in to get line 1 and 2 descriptions;


IF salesline.FINDFIRST THEN BEGIN
Desc := salesline.Description;
IF salesline.NEXT <>0 THEN
Desc2 := salesline.Description;
END;

however it does not seem like it is picking up second line

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,977 Super User 2025 Season 2 on at
    RE: Getting first 2 lines of sales order

    Its working fine in my case.

    please check whether you have applied proper filters on Salesline records.

  • Saurabh Shah Profile Picture
    4,560 on at
    RE: Getting first 2 lines of sales order

    Can you please let us know starting from the filters to get the sales line so it can give more better idea.

  • Community Member Profile Picture
    on at
    RE: Getting first 2 lines of sales order

    salesline.SETRANGE("Document Type","Document Type");

    salesline.SETRANGE("Document No.","No.");

    IF salesline.FINDFIRST THEN BEGIN

         Desc := salesline.Description;

     IF salesline.NEXT <>0 THEN

        Desc2 := salesline.Description;

    END;

  • Suggested answer
    Mohana Yadav Profile Picture
    60,977 Super User 2025 Season 2 on at
    RE: Getting first 2 lines of sales order

    Did you check whether you are applying correct filters?

    Its working fine again.

    Please add

    Message('%1 %2',Desc,Desc2);

    at the end of your code and check

  • Community Member Profile Picture
    on at
    RE: Getting first 2 lines of sales order

    In the report it is moving desc2 to desc1 and skipping the desc1.  The message line put in shows the correct information.  

  • Suggested answer
    Mohana Yadav Profile Picture
    60,977 Super User 2025 Season 2 on at
    RE: Getting first 2 lines of sales order

    so the code is working fine.

    please check the report logic again. I didn't understand what you mean by moving desc2 to sesc1 and skipping etc...

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Getting first 2 lines of sales order

    I was able to do this by using the line 1 and 2 and then break after the counter >2 and it worked and I am not sure why but it is.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Alexander Ermakov Profile Picture

Alexander Ermakov 2

#2
SC666 Profile Picture

SC666 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans