ComponentOne Query 8.0
Extensions

Extensions is an advanced feature of C1Query schema. In most cases, you will find the default behavior satisfactory, without specifying extensions. In more complex cases, or when you need more control, you can use schema extensions in conjunction with the C1Query.ApplyExtensions property.

In many cases, two tables cannot be joined together directly, but they can be joined through a third table. For example, Customers and OrderDetails cannot be joined together without an intermediate Orders table. When all three tables, Customers, Orders and OrderDetails are present in a query, then they can be joined with:

Example Title
Copy Code
Customers.CustomerID = Orders.CustomerID AND Orders.OrderID = OrderDetails.OrderID

But if only two of them, Customers and OrderDetails are present, C1Query will need to add the third table, Orders, to the query in order to complete it. This process is called query extension.

Extending a query, C1Query first applies schema extensions, and only if that does not help, performs autoextension, adding views to the query using a special algorithm. Both schema extensions (specified in the schema and autoextension) are applied only if enabled in the ApplyExtensions property setting.

Specifying a schema extension, the developer gives C1Query a direct indication that certain set of views can be extended, if necessary, by adding certain views to the query.

To add an extension to the schema, use the Add new extension button on the Extensions palette. To edit an existing extension, double click on it in the Extensions palette, or choose Edit from the context menu. An Extension Designer window will open as an MDI child. You can have multiple designer windows open simultaneously in the schema designer.

Specifying an extension is very simple: just add some views to the left list box (Extend views) and to the right list box (Extend with). At run time, C1Query will add the views from the right list to a query, provided that all views from the left lest are already present, and that the query cannot be completed without extension. In our example, views on the left will be Customers and OrderDetails, and there will be a single view on the right: Orders.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback