DataEngine for .NET Standard | ComponentOne
Work with Data Engine / Transform Data / Simple Operations
In This Topic
    Simple Operations
    In This Topic

    In Simple operation transformation, the DataEngine employs simple operations such as addition, subtraction, multiplication, division etc. Simple operations do not involve any grouping or aggregation.

    Simple operations can be categorized into two types:

    Defining a query to perform simple operations

    This section describes how a user can formulate a DataEngine query to perform simple operations on base tables. The afore-mentioned simple operations are methods in the Op class of the C1.DataEngine assembly, which are invoked while defining the query used to perform a simple operation.

    Consider an example where the user has imported the data from the “Invoices” database table to the DataEngine base table named “Invoices” (Refer Connect DataEngine to Database topic for more details). Using this data you can calculate the total payable amount corresponding to each order. This can be calculated by summing the extended price and the freight cost values present in the ‘ExtendedPrice’ and ‘Freight’ columns of the Invoices table.

    To implement this operation, you need to define the following query using the Add method of the Op class, which would perform the Add binary operation:

    // Retrieve the base table for use in constructing queries
    dynamic invoice = workspace.table("Invoices");
    
    // Find the total payable amount(including the freight cost) corresponding to each order
    dynamic query = workspace.query("TotalPayableAmounts", new
    {
        Order_ID = invoice.OrderID,
        Product_ID = invoice.ProductID,
        TotalPayableAmount = Op.Add(invoice.ExtendedPrice, invoice.Freight)
    });