Active Query Builder 2 .NET Edition reference
CustomizeDatasourceControlFieldList Event

Is called to customize the field list of a DataSource at the Design Area.
Public Event CustomizeDatasourceControlFieldList As CustomizeDatasourceFieldListEventHandler
Dim instance As QueryBuilderControl
Dim handler As CustomizeDatasourceFieldListEventHandler
AddHandler instance.CustomizeDatasourceControlFieldList, handler
public event CustomizeDatasourceFieldListEventHandler CustomizeDatasourceControlFieldList
public: __event CustomizeDatasourceFieldListEventHandler* CustomizeDatasourceControlFieldList

CustomizeDatasourceControlFieldList event allows to sort fields within the list or remove unwanted fields from the list.

This event differs from the CustomizeDatasourceFieldList Event in that it's fired more frequently, but only after the SQL parsing is complete, so you can examine the QueryBuilder.QueryStatistics collections and other internal query structure objects in this event's handler.

The field list to be customized is passed through the fieldList parameter.
The datasource parameter refers to the DataSource being added to the Design Area.

This sample demonstrates usage of the QueryBuilder.QueryStatistics.UsedDatabaseObjectColumns collection to remove unused fields from the DataSource field lists at the Design Area.
protected void QueryBuilderControl1_CustomizeDatasourceFieldList(QueryBuilder queryBuilder, DataSource datasource, MetadataFieldList fieldList)
    if (datasource.MetadataObject == null) return;
    for (int i = fieldList.Count - 1; i > 0; i--)
        bool found = false;
        for (int j = 0; j < queryBuilder.QueryStatistics.UsedDatabaseObjectColumns.Count; j++)
            if (datasource.MetadataObject.NameStr == queryBuilder.QueryStatistics.UsedDatabaseObjectColumns[j].ObjectName.Token &&
                fieldList[i].NameStr == queryBuilder.QueryStatistics.UsedDatabaseObjectColumns[j].Name.QualifiedName)
                found = true;
        if (!found) fieldList.Delete(i);
See Also


QueryBuilderControl Class
QueryBuilderControl Members



© Copyright 2005-2012 ActiveDBSoft. All rights reserved.

Send Feedback