Monday, 3 November 2014

Evaluate Methematical Expressions in Dynamics AX

Using bulitin XppCompiler of Dynamics AX, we can easily evaluate/ calcualte complex mathmeatical expression in AX. its veru storng and easy usable API.
Here goes an example that demonstrates how to use it.

static void calc(Args _args)
{
    XppCompiler x;
    Str s = "5-8*(3*2)/tan(25)";
    Str result;
    ;
   
    x = new XppCompiler();
    if (x.compileExpr(s))
    {
        result = x.execute();
    }
    else
    {
        result = "Error in expression!";
    }
   
    info(result);
}

No comments:

Post a Comment