ComponentOne FlexPivot for WinForms
DataEngine Overview / Using C1DataEngine / Combining Operations and Queries
In This Topic
    Combining Operations and Queries
    In This Topic

    A query line can have only have one operation in it. In simple words, you cannot combine operations to form a complex formula. However, this is not a problem because queries can be easily combined and results of any query can be fed as input to another query. So, you can perform some simple operations first and then apply an aggregation query to calculate subtotals on their results. You can also apply simple calculation operations to results of an aggregation, or build any other combination you need.

    One common case is specifically supported so that you can avoid creating multiple queries. You can define a column in a query and then use its string name as the argument of an operation. This combination can be represented in a single query as follows.

    Syntax

    discount = Op.Max(Op.Mul(od.UnitPrice, od.Discount)),
    MaxDiscount = Op.Max("discount")
    
    discount = Op.Max(Op.Mul(od.UnitPrice, od.Discount)),
    MaxDiscount = Op.Max("discount")
    

    When you combine queries, that is, define a query that is based on another query, the resulting query contains by default only the columns that are defined in it explicitly. In other words, it does not by default include columns from the query on which it is based. However, sometimes your query just needs to add a few columns to those in the base one (for example, add two columns of the base query) or it might show the same columns only filtered by a condition. You can do it by adding a line for each column as given below:

    columnName = baseQuery.columnName 

    A shortcut for the above case is adding _base = "*"