How to Use List Enunumerator in AX 2012


For example if we have a data in the grid with some special character separator like (; )
we will use the following process.


In my scenario i have a data like

 Field Data ->       InventoryAdjustments;Transfers;IntercompanyTransferOrders

In this Unbound control we have a data ->DMSPartnerBlockingTable_DMSTransactionType.valueStr();

NoYesId                                     isDealer;
boolean                                     ret;
List                                        list;
ListEnumerator                              listEnumerator;
str                                         requestStatus,testValue;
DmsPartnerType                              partnerType = 'SPD';
           
ret = super();
if(DMSPartnerBlockingTable.BlockingType == DMSBlockingType::ValueVolume)
{
    requestStatus      = DMSPartnerBlockingTable_DMSTransactionType.valueStr();
           
    list = new List(Types::String);
    list = strSplit(requestStatus, ';');
    testValue = '';
    listEnumerator = new ListEnumerator();
    listEnumerator = list.getEnumerator();
           
    while (listEnumerator.moveNext())
    {
        testValue = listEnumerator.current();
           
        if((testValue == (enum2str(DMSTransactionType::InventoryAdjustments))) ||  (testValue == (enum2str(DMSTransactionType::Transfers)))  ||
            (testValue == (enum2str(DMSTransactionType::IntercompanyTransferOrders))))
        {
            DMSPartnerBlockingTable_DMSTransactionType.text(' ');
            DMSPartnerBlockingTable.DMSTransactionType = '';
            throw error("@DMS3602");
        }
        else
        {
            DMSPartnerBlockingTable.DMSTransactionType = DMSPartnerBlockingTable_DMSTransactionType.valueStr();
        }
    }
}

Comments

Popular posts from this blog

Create RFQ through X++

Base enum values in Dynamics 365

Project Id through X++ code