HomeActive Query BuilderHow Do You Set Alias Names for Table and Fields

How Do You Set Alias Names for Table and Fields

How can I programmatically set the table names and fields from either the xml metadata import or using the AddTables or AddFields?

We are needing to set the alias names from our local data dictionary tables to give user defined alias names.

Bill Brittain
Bill Brittain | email
November 26 2007, 12:52 PM
Dear Bill,

To define alternate names, use the MetadataContainer.Edit method to call the Metadata container editor and enter alternate names for each required database object and field. To do this programmatically, you may use the AltName property of TacMetadataObject and TacMetadataField objects that are items of the MetadataContainer collection. Another way to define alternate names is to set them in the XML file that stores metadata information. You should use the "alt_name" sub-element of the "object" and "field" elements to define alternate names.

To activate usage of alternate names, you should set the UseAltNames property to True. Working with alternate names, Active Query Builder generates two different SQL texts: one for the user, that contain alternate names instead of real database objects. The end-user may edit this SQL text as usual and Active Query Builder will be able to parse it back to its visual representation correctly. The second SQL, that contains only real database names, is for database server execution. You should use the TacSQLBuilderPlainText.SQL property to get the end-user SQL text with alternate names, and the TacQueryBuilder.SQL property to assign such SQL text after editing by the end-user. The new TacQueryBuilder.SQLForServer property is added to retrieve the SQL text with real database object and field names, that should be passed to the database server.

Hope this information will be helpful for you. If this is not what you need, please give us an example of what you want to get in result.

Sergey Smagin
Sergey Smagin | email
15 hours, 24 mins since original post
This topic is closed