NevronOpenVision
Nevron.Nov.Formulas Namespace / NFormulaCalculator Class
Members
In This Topic
    NFormulaCalculator Class
    In This Topic
    The NFormulaCalculator class is used for the runtime parsing and evaluation of formulas.
    Object Model
    NFormulaCalculator Class
    Syntax
    public class NFormulaCalculator 
    Remarks
    A formula expression is string, which can be evaluated to a single variant value. A valid formula expression is composed by elements of one of the following types.

    • Numbers These are integer and floating point numbers. For example: 12, 0.1, 145.23, 7.5E-17, 8.234E+13 etc.
    • Boolean values These are the true and false boolean constants, which in the expression can be represented by the following strings: true, false, True, False, TRUE and FALSE
    • Strings In the formula expression, strings must are enclosed in " characters. For example: "hello", "world" etc.
    • Operators Supported is a common set of binary and unary operators. For example: +, -, *. /, = etc.
    • Parenthesis The '(' and ')' characters can used to change the operators priviledge.
    • Functions Supported is a large set of mathematical, logical, string, bitwise and date-time functions. For example: MIN, MAX, SIN, COS etc. Function arguments must be enclosed in parenthesis and divided by commas.
    • Variables The recognized set of variables is dynamically resolved by the calculator through the currently specified VariableProvider.

    The following example evaluates a formula expression: // create the formula calculator NFormulaCalculator calculator = new NFormulaCalculator(); // set formula calculator.Formula = "a + b * 2"; // set variables calculator.Variables["a"] = new NVariant(10); calculator.Variables["b"] = new NVariant(20); // evaluate an expression (evaluates to 50) NVariant result = calc.Evaluate();
    Inheritance Hierarchy

    System.Object
       Nevron.Nov.Formulas.NFormulaCalculator

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later)

    See Also