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 AX (Archived)

CommaTextIO occasionally writing empty file

(0) ShareShare
ReportReport
Posted on by 135

Hello,

There is a process for our business that writes out order information to a csv file that is then FTP'd to a shipping company.  However, this process sometimes writes out an empty csv file when there should have been data.  I cannot figure out the problem with the code and was wondering if perhaps I was doing something obviously wrong?  _conRecords is a container of containers, where the containers hold the information such as item number, price, etc. 

fullFileName = HAExportFileHelper::createFileName(_filePath, _fileName, _extention);
fileIOPermission = new FileIOPermission(fullFileName, #io_write);
fileIOPermission.assert();
commaIoWrite = new CommaTextIo(fullFileName, #io_write, #ANSIEncoding);

commaIoWrite.outFieldDelimiter(_fieldDelimiter);
commaIoWrite.outRecordDelimiter(#delimiterCRLF);

conLength = conLen(_conRecords);

for (conIdx = 1; conIdx <= conLength; conIdx++)
{
commaIoWrite.write(conPeek(_conRecords, conIdx));
}

commaIoWrite = null;
CodeAccessPermission::revertAssert();
info(strFmt("Data has been exported to file %1.", fullFileName));

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    297,339 Super User 2025 Season 2 on at
    RE: CommaTextIO occasionally writing empty file

    Hi AXGreenHorn,

    Are you using the same filename or are there some variables like date/time which is added to the filename? Have you reviewed the coding which compiles the container _conRecords? Have you also tried to use the debugger to find out more on this?

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans