The Alternate Names feature for both database objects and their fields lets completely substitute real names of objects for clearer descriptive names. So it's possible to simplify understanding of database structure and consequently building of queries to end users. 'Complete substitution' means substitution of objects names in both user interface, SQL expressions and in the query text which can be edited manually by end user among with visual query building. Active Query Builder lets assign alternate name to every object and field loaded to the Metadata Container.

You can get SQL text either with real or alternate names at any time. The UseAltNames property of PlainTextSQLBuilder component determines what names to use. Whereas several PlainTextSQLBuilder components might be connected to one QueryBuilder component, you can get both variants of the query text simultaneously: one for the end-user and another for executing query against the database server. On parsing a query, the component is able to recognize both real and alternate names of fields, so user can read and edit both variants of the query.

The same named property of the QueryBuilder component is responsible for displaying of real or alternate names in the query building user interface.
Some customers even use this peculiarity for refactoring of database structure by passing the suite of existing queries through the component and getting queries with new names of fields and objects in result.
Alternate names can be assigned in several ways.
  1. They could be added via the "alt_name" tag of fields and objects in the saved metadata XML file (manually using the or with the help of the metadata editor).
  2. Using the QueryBuilder.MetadataContainer MetadataObjectLoaded (for objects) and ObjectMetadataLoaded (for fields) events you can assign alternate names while they are loaded to the Metadata Container. For example, you can use descriptions of the objects being loaded by the component from database as alternate names.

Is this article helpful for you?