Show / Hide Table of Contents

    DataStoreExtensions.Modify(string modString) Method

    .NET Standard 2.x

    Modifies a DataStore object by applying specifications, given as a list of instructions, that change the DataStore object's definition.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

    public static string Modify(this IDataStore dataStore, string modString);
    

    Parameters

    modString System.String

    A string whose value is the specifications for the modification.

    Returns

    System.String

    Returns the empty string ("") if it succeeds and an error message if an error occurs.

    Examples

    The following code example demonstrates how to use the Modify method to modify the sort condition and then get the Departmentid value in the first row.

    using System;
    using DWNet.Data;
    using PowerScript.Bridge;
    
    namespace Appeon.ApiDoc.DataStoreExtensionsExamples
    {
        public class ModifyExample
        {
            private readonly SchoolContext _context;
    
            public ModifyExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
                // Modifies the sort condition to sort by Departmentid in descending order
                datastore.Modify($"DataWindow.Table.Sort='Departmentid D'");
    
                datastore.Retrieve();
    
                // Gets the value of Departmentid in the first row
                int id = datastore.GetItem<int>(0, "Departmentid");
    
                Console.WriteLine($"id={id}");
    
                /*This code produces the following output:
                
                id=7           
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon