How to create a CSV file ?

Suppose i have a requirement that a CSV file need to be created and some records will be exported to it at specified location without getting it opened.?How can we do that ?

Hi Vimal,

You can use DataPorts to create CSV files.

Hi Erik,

Dataports won’t be working in NAV7(Release 2012). So i have to make a report.

Cheers,

Vimal

for exporting data to excel you can use data migration tools in nav

Administration Menu->Application Setup->Company Setup->Data Migration

Migration → migration fields tick "include " fields

functions >> export to excel

If you really want to use a report, you could use a “File” variable, but make sure your not putting it on the server.

OnPreDataItem()
IF NOT FILE.EXISTS() THEN
FILE.ERASE();

fileExport.CREATE();
fileExport.TEXTMODE := TRUE;
fileExport.WRITEMODE := TRUE;

OnAfterGetRecord()
fileExport.WRITE(STRSUBSTNO(’%1;%2;%3;%4;…",
);

OnPostDataItem()
fileExport.CLOSE;