Use BinData class to create a simple text file using axapta.
Firstly create an instance of a TextBuffer class and append text using textBuffer.AppendText. Pass it to binData what you want to write using binData.setStrData and then write using binData.saveFile.
See this following code:
static void WriteFile(Args _args)
{
CustTable custTable;
BinData binData;
TextBuffer textBuffer;
;
textBuffer = new TextBuffer();
textBuffer.setText('');
while select custTable where custTable.AccountNum < '40020'
{
textBuffer.appendText(strfmt('%1 \n',custTable.AccountNum));
}
textBuffer.getText();
binData = new BinData();
binData.setStrData(textBuffer.getText());
binData.saveFile(@"c:\iba.txt");
}
{
CustTable custTable;
BinData binData;
TextBuffer textBuffer;
;
textBuffer = new TextBuffer();
textBuffer.setText('');
while select custTable where custTable.AccountNum < '40020'
{
textBuffer.appendText(strfmt('%1 \n',custTable.AccountNum));
}
textBuffer.getText();
binData = new BinData();
binData.setStrData(textBuffer.getText());
binData.saveFile(@"c:\iba.txt");
}
Happy Daxing!
Aucun commentaire:
Enregistrer un commentaire