Virtual Fields and Objects lets simplify visual building of queries in the case when same derived tables, correlated sub-queries or SQL expressions are frequently used in other queries. Active Query Builder allows representing such entities as Virtual Objects and Fields. Virtual entities don't differ from ordinary database objects and fields; the end-user works with them as if they were real objects and fields.
Substitution of virtual entities for containing expressions is performed seamlessly same way as alternate names.
Virtual Object acts as a database view. It holds a SELECT query inside, so the Virtual Object name is substituted for containing query and becomes a derived table when executing such query against the database server.
The virtual (calculated) field can represent complex SQL expressions, and correlated subqueries may be. For example, one can add the "Customer" virtual field to the "Orders" table containing the following SQL expression: "(SELECT c.Customer_Name FROM Customers c WHERE c.Customer_Id = Orders.Customer_Id)". When this field is selected in a query, the user will get the name of the customer in the query result set.
You can add virtual objects and fields to the Metadata Container the same way as ordinary objects and fields, additionally assigning SQL expression text to the Expression property of MetadataField and MetadataObject objects.