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)
How to add the Display method in the form level in D365 F&O
The below examle is to add the form -Data source level adding display method and assigning to form design control.
- 
static void createForm(Args _args) { Args args; Form form; FormRun formRun; FormBuildDesign formBuildDesign; FormB...
 - 
Please click here to access Custom Workflow step by step process:
 - 
1. In classDeclaration extend SrsReportDataProviderPreProcess instead of SrsReportDataProviderBase 2. Temp table properties should b...
 
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();
}