XppCompiler - volání externího X++ kódu s parametrem.

Zde je ukázka kódu jak používat třídu XppCompilator.

 static void ExecuteCodeFromFile(Args _args)
{
    #File
    
    AsciiIo     asciiIo = new AsciiIo("c:\\findCustomer.xpp",#io_read);
    XppCompiler xppCompiler = new XppCompiler();
    Source      sourceXppCode;
    str         sourceXppLine;
    
    CustTable   sampleReturnValue;
    
    ;
    if (asciiIo)
    {
        asciiIo.inFieldDelimiter(#delimiterEnter);
        [sourceXppLine] = asciiIo.read();

        while (asciiIo.status() == IO_Status::Ok)
        {
            sourceXppCode += #delimiterEnter;
            sourceXppCode += sourceXppLine;
            [sourceXppLine]  = asciiIo.read();
        }

        if (!xppCompiler.compile(sourceXppCode))
            error (xppCompiler.errorText());

        sampleReturnValue = runbuf(sourceXppCode,'4000');
        print sampleReturnValue.Name;
    }
    else
        print "Could not open file";

    pause;
}

A ukázka možného interpretovaného kódu:

 CustTable findCustomer(CustAccount _accountNum) 
{ 
    return CustTable::find(_accountNum); 
} 

Karel F