Scope: managed applications, mobile applications, and ordinary applications.
1. Data source aliases must clearly state their purpose. Requirements for source aliases are similar to the requirements for variable names in the code.
- Create aliases using industry-specific terms to clearly understand how the data source will be used in queries.
- Create aliases by deleting spaces between words. In this case, every word in the name is capitalized (for example, GoodsAndServices). Prepositions and pronouns consisting of one letter need to be capitalized as well.
- Avoid starting alias names with an underline.
- Aliases must not consist of one character.
Incorrect:
SELECT
Table1.Ref AS Goods,
IsNULL(Table2.CountBalance, 0) AS Balance
FROM
Catalog.Products AS Table1
LEFT JOIN AccumulationRegister.Stock.Balance AS Table2
BY Table1.Ref = Table2.Products
Correct:
SELECT
AllProducts.Ref AS Goods,
IsNULL(WarehouseBalance.CountBalance, 0) AS Balance
FROM
Catalog.Products AS AllProducts
LEFT JOIN AccumulationRegister.WarehouseBalance.Balances AS WarehouseBalance
BY AllProducts.Ref = WarehoseBalance.Products
In particular, we do not recommended that you use names of metadata object classes ("Catalog", "Document", and other) as such aliases will not show the source purpose in a particular query.
2. You can use universal aliases upon developing universal tools to work with arbitrary data tables or upon writing universal queries, when a particular table name is inserted instead of the data source upon code execution.
Example:
"SELECT
Table.Description AS Description
Table.Code AS Code
FROM
&Table AS Table";
QueryText = StrReplace(QueryText , "&Table", "Catalog." + CatalogName);