web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Mathematical Expression
Finance forum

Mathematical Expression

(3) ShareShare
ReportReport
Posted on by 49,668 Super User 2026 Season 2

In 2012 for mathematical expression we used XppCompiler which is deprecated in Dynamics 365 .

In Dynamics 365 "ProdMathEvaluator::evaluate" and "Microsoft.Dynamics.Ax.Frameworks.Controls.ProductConfiguration.MathEvaluator::Evaluate" are available but these functions produce error when expression contains ternary operator

i.e. "4<3? true ,false"

 

Would be kind of you, if you may suggest any alternative.

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    Hi Sohaib,

    You probably can do the same using CSharpCodeProvider blogs.msdn.microsoft.com/.../c-3-0-and-codedom

  • Martin Dráb Profile Picture
    240,278 Most Valuable Professional on at

    I've never seen a ternary operator in mathematics.

    Also, relational operators (such as <) returns true or false (that's why you can use them in the condition of the ternary operator), therefore you already have the result.

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    Hi ievgen,

    cheers for suggestion. That sounds a workable way.

    Hi Martin,

    You are right. that makes sense what you said. But we want to use different expressions based on some condition, for that purpose we need ternary operator

  • Martin Dráb Profile Picture
    240,278 Most Valuable Professional on at

    Okay, but then you're not talking about mathematical expressions and you can't use tools for mathematical expressions (such as MathEvaluator). Therefore your next step is analyzing what kind of expressions you need, so you can't start looking for the right solution.

    Ievgen suggestion is great if you want to generate arbitrary C# code, but maybe you don't need nor want it. Maybe you can use expressions of GER, use an interpreted language, design a simple custom DSL by yourself or so...

  • Mohamed Asarafali Profile Picture
    445 on at

    Hi sohaib,

    HAve you find any resolution to it. IF yes please could you post it; It would be helpful

  • Maen.Moutaz Profile Picture
    239 on at

    Hi Sohaib ,

    How i can evaluate expression like this  "(NoYes::Yes==NoYes::Yes) && (NoYes::No==NoYes::No)" in D365

    Any suggestion ?

    thanks ,

    Ma'en.M

  • Martin Dráb Profile Picture
    240,278 Most Valuable Professional on at

    Ma'en Moutaz, I think the whole thread is about such suggestions. Have you considered the thing with which this discussion started, i.e. ProdMathEvaluator?

    If none of the suggestions work for you, can you explain why not, so we can suggest something that solves this problem?

    Also, consider a more realistic example. You example doesn't have to be evaluated at runtime, because it doesn't have any variables.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans