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 :
Small and medium business | Business Central, N...
Suggested Answer

Sorting column in ExcelBuffer NAV2018

(0) ShareShare
ReportReport
Posted on by 5

Hi everyone,

I'm new with dynamics NAV and I'm currently working on an Excel export using ExcelBuffer. I would like to know if it's possible to sort data in ExcelBuffer based on a specific column. My problem is that I need to process data from several sources and have calculated data on which I have to sort. So I can't sort on my datasource directly.

My code is something like this :

excelbuffer.createbook(...);
if myRecord.findset then begin
repeat
    entercell(data from myRecord);
    calculate myDate which is based on data from myRecord and another data source
    entercell(myDate);
until myRecord.next = 0;
end;

//need to sort excelbuffer on myDate

excelbuffer.writesheet(...);
excelbuffer.closebook;
excelbuffer.openexcel;
excelbuffer.giveusercontrol;

We are working with NAV2018 and VS Code

Thank you

Aurore

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/.../

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

  • Aurore999 Profile Picture
    5 on at

    Hello Marco,

    Thank you for your response. I will take a look at your links for additional support.

    Have a nice day,

    Best regards,

    Aurore

  • Suggested answer
    Community Member Profile Picture
    on at

    Have you tried sorting by SETCURRENT Key?

    you can define fields on basis of which your sorting is to be done

    https://docs.microsoft.com/en-us/dynamics-nav/setcurrentkey-function--record-

    excelbuffer.createbook(...);

    MYRECORD.SETCURRENTKEY(FIELD1,FIELD2,FIELD3);
    if myRecord.findset then begin

  • Aurore999 Profile Picture
    5 on at

    Hi TechWorld

    Thank you for your answer. I didn't use SETCURRENTKEY on "myRecord" because the field (myDate) on which I want to sort the ExcelBuffer is not part of "myRecord". This is column I add to the ExcelBuffer and that is calculated when go through all records in "myRecord".

    Aurore

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans