This article will cover the syntax of the ‘alias’ regular script statement.
The alias statement is used to rename a field to a specific name every time it occurs in the script following the statement.
Statement syntax
Alias fieldname as aliasname {,fieldname as aliasname}
Fieldname | The current name of the field to be renamed. |
Aliasname | The new field name. |
Example
This example sets 3 different variations of the field ‘customer ID’ to a new common alias to link the data model tables together correctly.
Alias
"Client ID" as "Customer ID",
"Customer Key" as "Customer ID",
"Customer" as "Customer ID";
CUSTOMER_NAME:
LOAD * INLINE [
Client ID, Client Name
12345, John Smith
];
CUSTOMER_LOCATION:
LOAD * INLINE [
Customer Key, Client Location
12345, Australia
];
CUSTOMER_BUSINESS:
LOAD * INLINE [
Customer, Client Business
12345, Textile Manufacturer
];
Result
The result is that all 3 tables are correctly associated on the field ‘Customer ID’ in the data model.