static void StringSplitter(Args _args)
{
GeneralJournalAccountEntry generalJournalAccountEntry;
TextBuffer buffer;
str value;
Counter cnt;
value = "1000-524-457-524";
//select generalJournalAccountEntry;
buffer = new TextBuffer();
buffer.setText(value);//generalJournalAccountEntry.LedgerAccount);
while (buffer.nextToken(0, '-'))
{
cnt++;
if(cnt == 1)
info (strFmt("first %1",buffer.token()));
if(cnt == 2)
info (strFmt("two %1",buffer.token()));
if(cnt == 3)
info (strFmt("three %1",buffer.token()));
if(cnt == 4)
info (strFmt("four %1",buffer.token()));
}
}
This blog is for Dynamics AX (AXAPTA) Developers,this will help you for your development issues. This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use.
Subscribe to:
Post Comments (Atom)
Ledger Voucher creation Framework and x++ code to create ledger voucher
Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...
-
{ "Message" : "Please verify that the user is valid and set up correctly." } Sol: System Administration > Se...
-
Please click here to access Custom Workflow step by step process:
-
FormRun formRun = sender.formRun(); Object inventTrans_ds = formRun.dataSource(formDataSourceStr(InventMarking,InventTransO...
another way you could've done this is using str2con & con2str. interesting take on the matter though
ReplyDeleteAnother way to do it in D365FO/AX
ReplyDeletevalue = "1000-524-457-524";
List listLedgerAccounts = new List(Types::String);
listLedgerAccounts = strSplit(value, '-');
ListIterator listIterator = new ListIterator(listLedgerAccounts);
int i = 1;
while (listIterator.more())
{
info(strFmt('Count: %1, Ledger Account: %2', i, listIterator.value());
i++;
listIterator.next();
}