Wednesday, January 9, 2019

AX - How to split string to parts

The field custVendExternalItem.Description contains value "PO885895/C".

For split to strings with "/" delimiter use this code:
List list = new List( Types::String );
ListEnumerator listEnumerator;
int iCounter;
...
/* split field custVendExternalItem.Description */

list = strSplit( custVendExternalItem.Description, "/" );
                                    
listEnumerator = list.getEnumerator();    
iCounter = 1;
while ( listEnumerator.moveNext() ) {                
   if ( iCounter == 1 ) tmpTable.PO_number = listEnumerator.current();
   if ( iCounter == 2 ) tmpTable.revision = listEnumerator.current();
                
   iCounter++;  
}

No comments:

Post a Comment