DumontEXE 0.0.1
Object Alias Names

The cda object system supports a feature called alias names. This feature allows a separate unique name to be assigned to an object, and allows that object to be referred to by that alias name.

This feature is provided as a matter of convenience, but is rather handy when referring to Application names Field names and Connection names. Using the alias name mechanism, generic code can be written to access fields and connections on a form within a category and the alias names can be set to match the code - just like a mini field mapping tool. Care should be taken to insure that the alias names do not collide with existing names within the same name-list-context. For instance, if there is a list of field names, and some of those fields have alias names assigned to them, then care must be taken that the alias names do not collide with any other existing alias names, or any other regular field names.

Just like in a category you cannot have two fields with the same name, also in a category you cannot have an alias field name that duplicates either another field name, or another alias field name. The cda insures that this will not happen.

The alias name feature is especially handy when acquiring a handle to the database via the dumont.ROT object. Using the alias name, a .vbs script file can be developed that will always access the correct instance of the database regardless of what the database is actually called on that client installation.

vbScript Access to an Application via its alias name
 dim dexe: set dexe = createObject("Dumont.EXE") ' hook dumont
 dim dapp: set dapp = dexe.applications( "KES" ) ' get application by aliasName
 if( dapp.objectIsValid ) then
   dexe.debug "application name:  " & dapp.name
   dexe.debug "database name:     " & dapp.databaseName
   dexe.debug "database dir:      " & dapp.databaseDirectory
   dexe.debug "application alias: " & dapp.aliasName
   dexe.debug "----"
 end if
 
 set dapp = dexe.applications( "KES.mwp" )       ' get application by name
 if( dapp.objectIsValid ) then
   dexe.debug "application name:  " & dapp.name
   dexe.debug "database name:     " & dapp.databaseName
   dexe.debug "database dir:      " & dapp.databaseDirectory
   dexe.debug "application alias: " & dapp.aliasName
   dexe.debug "----"
 end if

The code above will produce the following output:

cmcObjectAliasName.png

The aliasName property is available on any object within the system and allows those objects, applications, forms, categories, fields and connections to be accessed by their generic alias names.

This makes it possible to write a truly generic piece of code that can access applications and categories and fields and by using the aliasName property of those object, map the generic names to the actual database object names. Especially as it relates to the Dumont running object table, a generic .vbs file can be distributed to all the client computers and regardless of what the database was named when it was connected to the workgroup, the script will be able to access it through the R.O.T. by its alias name.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database User Support Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com