Friday, December 19, 2008

ExecuteCodeFromFile

static void ExecuteCodeFromFile(Args _args)

{

    #File

    AsciiIo     asciiIo = new AsciiIo("c:\\findCustomer.xpp",#io_read);

    XppCompiler xppCompiler = new XppCompiler();

    Source      source;

    str         line;

    CustTable   custTable;

    ;

    if (asciiIo)

    {

        asciiIo.inFieldDelimiter(#delimiterEnter);

        [line] = asciiIo.read();



        while (asciiIo.status() == IO_Status::Ok)

        {

            source += #delimiterEnter;

            source += line;

            [line]  = asciiIo.read();

        }



        if (!xppCompiler.compile(source))

            error (xppCompiler.errorText());

        custTable = runbuf(source,'4000');

        print CustTable.Name;

    }

    else

        print "Could not open file";



    pause;

}
/*
The external file c:\temp\findCustomer.xpp:

CustTable findCustomer(CustAccount _accountNum)

{

    return CustTable::find(_accountNum);

}
*/

No comments:

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...