HomeActive Query BuilderClick or Select event on table and link objects in .NET AQB

Click or Select event on table and link objects in .NET AQB


I have used the Free version of .NET AQB and it is great, but I have some problems. Is there an existing event to get the current clicked or selected object (table or link)? I want to display additional metadata information about the selected object, information which is stored in a different SQL table. I also want to add new metadata rows when an object is dropped in AQB designer and delete corresponding rows when the object is removed. Is this possible with both EventMetadataProvider and MSSQLMetadataProvider?
Is it also possible to get access to the controls created when the SQL property of the QueryBuilder is set to a valid SELECT statement?

Dan Radu | email
July 29 2008, 11:02 PM
Dear Dan,

To do something on addition of a new object, use the DiagramObjectAdded event. There you may add a select item, like it shown in the Non-Visual demo project that included in the Trial version installation package:

// create first output column (expression)
CriteriaItem ci1 = sq.CriteriaList.AddExpression("GetDate()");
ci1.Select = true;
ci1.AliasString = "d";

// create simple WHERE condition
CriteriaItem ci2 = sq.CriteriaList.AddExpression("CustomerID");
ci2.Select = false;
ci2.ConditionStrings[0] = "> 0";

// create second output column
CriteriaItem ci3 = sq.CriteriaList.AddField(ds1, "CustomerName");
ci3.Select = true;

// create third output column with condition
CriteriaItem ci4 = sq.CriteriaList.AddField(ds2, "OrderID");
ci4.Select = true;
ci4.ConditionStrings[0] = "> 0";

// order by...
ci3.SortType = ItemSortType.Desc;
ci3.SortOrder = 0;

When the object is removed from a query, all related select items are removed automatically, so there is no need for "DiagramObjectDeleted" event.

Sergey Smagin
Sergey Smagin | email
1 day, 7 hours since original post
This topic is closed