Wednesday, 2 March 2016

Get or split values start and end from range in AX 2012

For example you provided range from 100 to 110 and want both start and end value in some variable then you can use container to split range values.

static void GetSplitValuesFromRange(Args _args)
{
    str                 range;
    str                 startValue,endValue;
    List               ledgerRange = new list(Types::String);
    ListIterator    listIterator;
    container       con;


    range = "100...101";
    ledgerRange = strSplit(range,"..");
    listiterator = new listiterator(ledgerRange);
    while(listiterator.more())
    {
        con += listiterator.value();
        listiterator.next();
    }

    startValue  =  conpeek(con,1);
    endValue  =  conPeek(con,4);
    info(EndValue);

}

No comments:

Post a Comment