Show / Hide Table of Contents

    IDataStore.Evaluate<TValue>(string expression) Method

    .NET Standard 2.x | Current Version (1.0.1)

    0.5.0-alpha

    1.0.1 (current)

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

    Namespace: PowerBuilder.Data

    Assembly: PowerBuilder.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 PowerBuilder.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class EvaluateExample
        {
            private 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       
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon