Nevron Open Vision Documentation
Nevron.Nov.Formulas Namespace / NFormulaEngine Class
Members


In This Topic
    NFormulaEngine Class
    In This Topic
    The NFormulaEngine class is used for the runtime parsing and evaluation of formulas.
    Object Model
    NFormulaEngine Class
    Syntax
    'Declaration
     
    
    Public Class NFormulaEngine 
    'Usage
     
    
    Dim instance As NFormulaEngine
    public class NFormulaEngine 
    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 engine through the currently specified VariableProvider.

    The following example evaluates a formula expression: // create the formula engine NFormulaEngine engine = new NFormulaEngine(); // create a variable dictionary NVariableDictionary vars = new NVariableDictionary(); vars["a"] = new NVariant(10); vars["b"] = new NVariant(20); // assign the variable dictionary to the engine engine.VariableProvider = vars; // evaluate an expression (evaluates to 50) NVariant result = engine.Evaluate("a + b * 2");
    Inheritance Hierarchy

    System.Object
       Nevron.Nov.Formulas.NFormulaEngine

    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