Difference between revisions of "Table/Column Alias"

From Hornbill
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 18: Line 18:
 
|}
 
|}
  
==Table/Column_Alias==
+
==Table/Column Alias==
If you happen to create a report that extracts information from different tables such as the Assets, Requests, Asset Types tables, then you would have some fields with the same column names. This in itself is ok except if you are trying to read a report, you would confuse field names. This is where table and field aliases come in.
+
If you happen to create a report that extracts information from different tables such as the Assets, Requests, Asset Types tables, then you would have some fields with the same column names. This in itself is ok except if you are trying to read a report, you would confuse field names. This is where table and field aliases come in. In the example below, we are using SQL Schema Designer and four tables: h_itsm_requests, h_cmdb_assets, h_cmdb_asset_types and h_cmdb_links.  
  
You could add an alias for a table such as h_cmdb_asset_types simply because the table name is very long and you wish to shorten it for reference elsewhere.  
+
You could add an alias for a table such as h_cmdb_asset_types simply because the table name is very long and you wish to shorten it for reference elsewhere. You can do this by double clicking on the table name on the Select Tables tab. Then you should see the option to 'Add Alias' or 'Remove Table'
  
[[File:TableAlias.PNG|600px]]
+
[[File:AliasCreation.PNG|600px]]
  
[[File:AliasCreation.PNG|500px]]
 
  
The job of the fieldAlias is slightly different. In tables such as h_cmdb_assets you have a column called h_name. Similarly in table h_cmdb_asset_types, you also have a column called h_name so in order to create a report with these two tables, to avoid confusion, you can use field aliases to differentiate between the two fields. You can do this by double clicking on the table name on the Select Tables tab. Then you should see the option to 'Add Alias' or 'Remove Table'
+
[[File:TableAlias.PNG|700px]]
  
[[File:FieldAlias.PNG|600px]]
 
  
In the illustration, we are using SQL Schema Designer and four tables: h_itsm_requests, h_cmdb_assets, h_cmdb_asset_types and h_cmdb_links.  
+
 
 +
In tables such as h_cmdb_assets you have a column called h_name. Similarly in table h_cmdb_asset_types, you also have a column called h_name so in order to create a report with these two tables, to avoid confusion, you can use field aliases to differentiate between the two fields.
 +
 
 +
 
 +
[[File:Identicalfieldnames.PNG|600px]]
 +
 
 +
In the above illustration, Asset Name(h_cmdb_assets.h_name) could easily be confused with h_cmdb_asset_types.h_name. If you remember h_cmdb_asset_types was aliased to AssetTypes so in the diagram this is showing as AssetTypes->TypeName(AssetTypes.h_name)
 +
 
 +
[[File:FieldAlias.PNG|700px]]
 +
 
 +
By clicking on the Edit Report Columns shown with an Edit icon(pencil) you can add an alias for the field name.
 +
 
 +
[[Category:How To - Reporting]]
 +
 
 +
The end result is a report such as the one below:
 +
 
 +
[[File:ReportwithAlias.PNG|700px]]
  
 
[[Category:How To - Reporting]]
 
[[Category:How To - Reporting]]

Latest revision as of 13:09, 20 June 2018

Home > How To > Reporting > Table/Column_Alias

The following is a complete list of the Reporting "How To" guides, hints, tips and videos that have been created to aid in the configuration and usage of the system.

Related Articles

Table/Column Alias

If you happen to create a report that extracts information from different tables such as the Assets, Requests, Asset Types tables, then you would have some fields with the same column names. This in itself is ok except if you are trying to read a report, you would confuse field names. This is where table and field aliases come in. In the example below, we are using SQL Schema Designer and four tables: h_itsm_requests, h_cmdb_assets, h_cmdb_asset_types and h_cmdb_links.

You could add an alias for a table such as h_cmdb_asset_types simply because the table name is very long and you wish to shorten it for reference elsewhere. You can do this by double clicking on the table name on the Select Tables tab. Then you should see the option to 'Add Alias' or 'Remove Table'

AliasCreation.PNG


TableAlias.PNG


In tables such as h_cmdb_assets you have a column called h_name. Similarly in table h_cmdb_asset_types, you also have a column called h_name so in order to create a report with these two tables, to avoid confusion, you can use field aliases to differentiate between the two fields.


Identicalfieldnames.PNG

In the above illustration, Asset Name(h_cmdb_assets.h_name) could easily be confused with h_cmdb_asset_types.h_name. If you remember h_cmdb_asset_types was aliased to AssetTypes so in the diagram this is showing as AssetTypes->TypeName(AssetTypes.h_name)

FieldAlias.PNG

By clicking on the Edit Report Columns shown with an Edit icon(pencil) you can add an alias for the field name.

The end result is a report such as the one below:

ReportwithAlias.PNG