Home page  
Help >
ddlCreateFieldAlias() - create an alias name for a field
Version 7.11
ddlCreateFieldAlias() - create an alias name for a field

ddlCreateFieldAlias() is used to assign an alternate name, or alias, to an existing field.

Prototype:
   void ddlCreateFieldAlias(
      CONTROL *ctl,
      char *OptnStr,
      char *ArgList);          /* command argument list */
Permitted values in OptnStr: NA

Form of ArgList:
<TableName> <FieldName> <AliasName>
<TableName> represents the target Table name;
<FieldName> represents the name of the existing field that is to be assigned an alias
<AliasName> represents the name of the alias

Description:
This feature is designed primarily to be used in conjunction with the RELATE command. In cases where the fields connecting two or more tables have different names, one of the fields can be assigned the name of the companion field as an alias. This will allow the RELATE command to function as if the fields had the same name.

For example, if we have the following schema:
   TD CUSTOMERS ...
      LastName       X(20)
      ...
      SpouseLastName X(20)
      ...
   TD SALES ...
      LastName       X(20)
      ...
and if we want to do a RELATE using CUSTOMERS.SpouseLastName and SALES.LastName, we could do the following:
      CreateFieldAlias SALES LastName SpouseLastName
      ...
      RELATE a CUSTOMERS (SALES thru SpouseLastName) ...
      ...
      DestroyFieldAlias SALES SpouseLastName
There are several restrictions on <AliasName>:
1) The name <AliasName> must be an existing field name;
2) The existing field <AliasName> must be the same type and size as <FieldName>;
3) The name <AliasName> cannot pre-exist in <TableName> either as an existing field or as an alias.
4) The assignment of <AliasName> is local and temporary to the current session;

The ddlDestroyFieldAlias() function is used to remove an alias created by ddlCreateFieldAlias().


Value returned in Control.Ans1:
      If the command succeeds, %Answer1 contains "1".

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.