Sorting column in ExcelBuffer NAV2018

Aurore999
Member Posts: 3
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 :
We are working with NAV2018 and VS Code
Thank you
Aurore
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
0
Answers
-
Do you want to sort it out from NAV itself?Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
Thanks for your reply RockWithNAV,
Yes the idea is to sort the ExcelBuffer on a specific column before calling function writesheet
Aurore0 -
[Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks for your reply RockWithNAV,
Yes the idea is to sort the ExcelBuffer on a specific column before calling function writesheet
Aurore
I would suggest writing all the data you're calculating into a temporary table, then to sort that table and then write data from that temporary table to Excel Buffer0 -
Thanks for your reply RockWithNAV,
Yes the idea is to sort the ExcelBuffer on a specific column before calling function writesheet
Aurore
I would suggest writing all the data you're calculating into a temporary table, then to sort that table and then write data from that temporary table to Excel Buffer
HI ShaiHulud,
Thanks a lot for your answer. Do I need to choose an existing table and mark it as a temporary record or is there another way to create a temporary table and define columns I need ?
Best regards
Aurore0 -
Thanks for your reply RockWithNAV,
Yes the idea is to sort the ExcelBuffer on a specific column before calling function writesheet
Aurore
I would suggest writing all the data you're calculating into a temporary table, then to sort that table and then write data from that temporary table to Excel Buffer
HI ShaiHulud,
Thanks a lot for your answer. Do I need to choose an existing table and mark it as a temporary record or is there another way to create a temporary table and define columns I need ?
Best regards
Aurore
If you can find a table that would fit all the data you need (even if under incorrect field names), then you should use that, marking it as temporary. The disadvantage of that is that if anybody (Microsoft with a new CU or version; other developer; 3rd party add-on provider) make changes to that table, it might break your code.
Alternatively, you can design your own table in the custom rage (if permitted by license), still mark it as temporary to not actually put any of the calculated and processed data into the database (unless you need it for archiving purposes, like "what was exported on the 18th of June, 2020"), and use that.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions