Thursday, May 14, 2015

How to delete Label Files from AX 2012

Here are the steps to delete Label Files from AX 2012:

  • Create a new model. You could call it "Test".
  • Open the AOT and move the Label File(s) you want to get rid of to the new model.
  • Close AX and stop the AOS.
  • Use AXUtil to delete the new model.
  • Select the label files (name start with 'ax' and followed with label id. select all files) and Delete from the server folder; C:\Program Files\Microsoft Dynamics AX\60\Server\...\bin\Application\Appl\Standard
  • Start the AOS.
  • Skip the upgrade wizard.

Friday, February 6, 2015

Read text file and SubStr to fetch fixed length columns - AX 2012

static void readTextFile(Args _args)
{
    Container               con;
    Filename                filename, Filename2;
    FileIOPermission        permission;
    TextIO                  textIO, textIO1;
    Str1260                 line;
    #File
    ;
    
    Filename = @"C:\Test\testFile.txt";
    permission = new fileIOpermission(filename,"RW");
    permission.assert();
    textIO = new TextIO(filename,#io_read);
    //textIO.inFieldDelimiter('|');
    if(textIO)
    {
        while(textIO.status() == IO_Status::Ok)
        {
            con = textIO.read();
            if(con)
            {
                line = Global::con2Str(con);
                info(strFmt("text - %1",line));
                info(strFmt("Company id - %1",subStr(line,1,4)));
                info(strFmt("code - %1",subStr(line,5,6)));
                info(strFmt("account num - %1",subStr(line,12,14)));
                info(strFmt("transdate - %1",subStr(line,26,6)));
                info(strFmt("Cheque num - %1",subStr(line,32,10)));
                info(strFmt("amount - %1",subStr(line,42,8)));
                break;
            }
        }
    }
}