AX 2012 Number sequence DataTypeName

Use the following code to add DataTypeName to a Number sequence references export from AX 2012:
static void VKTest(Args _args)
{
    #File
    IO  iO;
    FilenameOpen        filename = "c:\\_temp\\number seq references v2.csv";
    FilenameOpen        filenameWrite = "c:\\_temp\\number seq references v2 extended.csv";
    Container           record;
    Container           recordWrite;
    int                 recordCounter = 0;
    int                 dataType;
    str                 dataTypeName = 'DATATYPENAME';
    CommaTextIo         fileWrite;
    FileIoPermission    perm;
    ;
    iO = new CommaTextIo(filename,#IO_Read);
    if (!iO || iO.status() != IO_Status::Ok)
    {
        throw error("@SYS19358");
    }
    
    perm = new FileIoPermission(filenameWrite, #io_write);
    perm.assert();
    
    fileWrite = new CommaTextIo(filenameWrite, #io_write);
    if (!fileWrite || fileWrite.status() != IO_Status::Ok)
    {
        throw error("@SYS19358");
    }
    
    while (iO.status() == IO_Status::Ok)
    {
        record = iO.read(); //To read file
        
        if (recordCounter)
        {
            dataType = conpeek(record, 9);
            dataTypeName = extendedTypeId2Name(dataType);
        }
        recordWrite = record + dataTypeName;
        fileWrite.writeExp(recordWrite);
        
        recordCounter++;
    }
   
    
    //info(strFmt("%1", extendedTypeId2Name(1295)));
    
}
AX 2012 Read / Write CSV file

 

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units and "buy me a coffee" link.
Join us.

Blog Tags