Show / Hide Table of Contents

    IDataStore.Evaluate<TValue>(string expression) Method

    .NET Standard 2.x

    Calculates the result of the specified DataWindow expression using the data in the primary buffer of the DataStore.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public TValue Evaluate<TValue>(string expression);
    

    Type Parameters

    TValue

    The type of the result value.

    Parameters

    expression System.String

    A DataWindow expression to evaluate.

    Returns

    TValue

    The result value.

    Examples

    The following code example demonstrates how to use the Evaluate<TValue>(String) method.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class EvaluateExample
        {
            private readonly SchoolContext _context;
    
            public EvaluateExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example1()
            {
                // Instantiates a DataStore object with dataobject: d_department
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    
                // This datastore has 4 records
                // Values of Budget are:
                // 350000.00, 120000.00, 200000.00, 250000.00
                // so sum(budget for all) is 920000.00
    
                decimal budget = datastore.Evaluate<decimal>("sum(budget for all)");
    
                Console.WriteLine("Sum(budget for all): {0}", budget);
    
                /*This code produces the following output:
                
                Sum(budget for all): 920000.0000       
                */
            }
        }
    }
    

    Example Refer To

    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon