Axapta 动态编译 (XppCompiler )

动态编译X++代码  
static void Job180(Args _args)
{
    XppCompiler xpp ;
 
    ;
 
      xpp = new XppCompiler();
      xpp.compile("    static int Job173(int k) "
       + " {                        "
       + "      int i,j;              "
       + "      ;                      "
+ "      i = 50;                "
+ "      j = 2;               "
     
+ "      return i*j+ k ;             "
+ " }");
      print xpp.execute(10);
    pause ;
}
 
计算字符串表达式
static void test_XppCompiler1(Args _args)
{
    XppCompiler xpp ;
     real       ret ;
    ;
 
    try
    {
        xpp = new XppCompiler();
        if ( xpp.compileExpr("(1+3)*5/3")== true)
        {
            ret = xpp.execute() ;
            print ret ;
        }
        else
            infolog.add(exception::Info,"error") ;
        pause ;
    }
    catch (exception::Error)
    {
        error("error") ;
    }
}

你可能感兴趣的:(Axapta,开发技术,axapta,exception)