CREATE COMMA SEPARATED FILES : DYNAMICS AX X++ CODE
public void createcommafiles()
{
CommaTextIo file;
container
line;
MainAccount mainAccount;
#define.filename(@'C:\accounts.csv')
#File
file =
new CommaTextIo(#filename, #io_write);
if (!file ||
file.status() != IO_Status::Ok)
{
throw error("File cannot
be opened.");
}
while select
MainAccountId, Name from mainAccount
{
line = [
mainAccount.MainAccountId,
mainAccount.Name];
file.writeExp(line);
}
info(strFmt("File
%1 created.", #filename));
}
No comments:
Post a Comment