Export Customers as a CSV file using Codeunit or Report

Jacob1227
Member Posts: 128
Hi All,
I want to export customers as a CSV file using Jobqueue.
Can you please provide me a piece of advice, whether i am creating code unit or report to run a jobqueue.
If it's possible through codeunit or report, please suggest me some piece of code to export a CSV file.
Thanks in advance,
Jacob.A
I want to export customers as a CSV file using Jobqueue.
Can you please provide me a piece of advice, whether i am creating code unit or report to run a jobqueue.
If it's possible through codeunit or report, please suggest me some piece of code to export a CSV file.
Thanks in advance,
Jacob.A
0
Best Answer
-
Did you even search the forum?
https://forum.mibuso.com/discussion/65967/export-to-csv-via-report-nav20155
Answers
-
I hate to say.. ๐
Tomorrow you'll have an example. If no one beats me to it.0 -
Did you even search the forum?
https://forum.mibuso.com/discussion/65967/export-to-csv-via-report-nav20155 -
Hello @Jacob1227 ,
If you really want to use a report, you could use a "File" variable, but make sure you are not putting it on the server.
OnPreDataItem()
IF NOT FILE.EXISTS(<Your FileName>) THEN
FILE.ERASE(<Your FileName>);
fileExport.CREATE(<Your FileName>);
fileExport.TEXTMODE := TRUE;
fileExport.WRITEMODE := TRUE;
OnAfterGetRecord()
fileExport.WRITE(STRSUBSTNO('%1;%2;%3;%4;..",
<Your Values>);
OnPostDataItem()
fileExport.CLOSE;1 -
Remove file only when it exists.0
-
And you gonna do things like add quotation marks and escape already existing quotation marks? In a more modern version like 17 or 18, one can use the CSV Buffer table. Unfortunately I have a similar problem in NAV2015, so I will probably backmigrate half of the functionality of the CSV Buffer...0
-
Thanks tally sachin and Miklos.Did you even search the forum?
https://forum.mibuso.com/discussion/65967/export-to-csv-via-report-nav2015
Tally,I have done it.Can you please tell me how to include a header?0 -
Do you want to include a header in a csv file?0
-
Yes Tally.0
-
OnPreDataItem()
IF FILE.EXISTS(<Your FileName>) THEN
FILE.ERASE(<Your FileName>);
fileExport.CREATE(<Your FileName>);
fileExport.TEXTMODE := TRUE;
fileExport.WRITEMODE := TRUE;
fileExport.WRITE(STRSUBSTNO('%1;%2;%3;%4;..",
<Your Header Values>);
OnAfterGetRecord()
fileExport.WRITE(STRSUBSTNO('%1;%2;%3;%4;..",
DELCHR(<Your Values>),'=',STRSUBSTNO('";');
OnPostDataItem()
fileExport.CLOSE;0 -
Hi Tally,
I have tried with your code but not able to include a header.
please look at my code and suggest me the changes.
0 -
Please post all lines of code as text, I Will correct them0
-
Hey Tally,
I got it .It works well now.Header also included.Thank u once again.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