Blog

Name is Anant Dubey and the intent to create this blog is to discuss the problems and issues that developer face in the dynamics AX development and to share the new things that come up with the new version of AX.

Monday, 20 January 2014

Generate Txt File on clicked in ax 2012

void clicked()
{
     LedgerJournalTrans   ledgerJournalTrans1;
    BinData     binData;
    TextBuffer  textBuffer;
    ;

    textBuffer = new TextBuffer();
    textBuffer.setText('');
        ledgerJournalTrans1 = LedgerJournalTrans_ds.getFirst(1);
    while(ledgerJournalTrans1) //where custTable.AccountNum < '40020'
    {

        textBuffer.appendText(strfmt('%1 %2 %3 %4 %5',ledgerJournalTrans1.LedgerDimension, ledgerJournalTrans1.Txt, ledgerJournalTrans1.AmountCurDebit, ledgerJournalTrans1.OffsetAccountType, ledgerJournalTrans1.OffsetLedgerDimension));
        ledgerJournalTrans1 = LedgerJournalTrans_ds.getNext();
    }

    textBuffer.getText();

    binData = new BinData();
    binData.setStrData(textBuffer.getText());
    binData.saveFile(@"d:\iban.txt");

}