Active Query Builder 2 .NET Edition reference
Query Transformer Introduction

There's a special component intended to change SQL queries accodring to the end-user data browsing needs: QueryTransformer. It needs to be linked to the QueryBuilder and SQLBuilder objects to get the initial query and to produce the modified query text in result.

This component automatically extracts columns of the query resultset and lets easily apply sorting, limits, filtration and add aggregates to the query. Follow the simple steps below to change the query the way you need:

  1. Find the column you need in the QueryTransformer.Columns collection:

        column = queryTransformer.Columns.ColumnByName("OrderDate")
    
  2. Create an object that defines the necessary modification:

        sorting = column.Ascending()
        filter = column.NotLess("31/12/2012")
        aggregate = column.Max("DateMax")
    
  3. Apply these objects to the query:

        queryTransformer.OrderBy(sorting)
        queryTransformer.Where(filter)
        queryTransformer.Select(aggregate)
    
  4. Apply limits to the query:

        If queryTransformer.IsSupportLimitCount() Then
            queryTransformer.Take("50")
        End If
    
  5. Get the modified query from the QueryTransformer.SQL property:

        MessageBox.Show(queryTransformer.SQL)
    

Below is the object relationship diagram.

 

 

 


© Copyright 2005-2012 ActiveDBSoft. All rights reserved.