What are Attributes?
Attribute view acts like a dimension. It join multiple tables and act as Master. Attribute view is reusable objects.
Attribute view has the following advantage-
- Attribute View act as Master data context, which provides Text or Description for Key/Non-key field.
- Attribute View can be reuse in Analytic View and Calculation View.
- Attributes View is used to select a subset of columns and rows from a database table.
- Attributes (fields) can be calculated from multiple table fields.
- There is no measure and aggregation option.
Attribute View Type
Attribute View are 3 types-
|Attribute View Type>||Description|
|Standard||It is a standard attribute which is created by table fields.|
|Time||It is Time attribute view, which is based on default time table –
For calendar type Gregorian –
For calendar type Fiscal –
|Derived||It is an attribute view which is derived from another existing attribute view. Derived attribute view will be opened in read-only mode. The only editable field is its description.
Copy From – When you want to define an attribute view, by copying an existing attribute View, then you can use “Copy From” option.
Note: Difference between Derived and Copy from is, in the case of derived, you can only edit the description of new attribute view while in the case of copy, you can modify everything entirely.
Standard view creation has pre-define step as below-
Table Creation for Attribute View
Here we are going to create Standard Attribute View for product table, so firstly we create “PRODUCT” and “PRODUCT_DESC” Table.
SQL Script is shown as below for table creation –
Product table Script –
CREATE COLUMN TABLE "DHK_SCHEMA"."PRODUCT" ( "PRODUCT_ID" NVARCHAR (10) PRIMARY KEY, "SUPPLIER_ID" NVARCHAR (10), "CATEGORY" NVARCHAR (3), "PRICE" DECIMAL (5,2) ); INSERT INTO "DHK_SCHEMA"."PRODUCT" VALUES ('A0001','10000','A', 500.00); INSERT INTO "DHK_SCHEMA"."PRODUCT" VALUES ('A0002','10000','B', 300.00); INSERT INTO "DHK_SCHEMA"."PRODUCT" VALUES ('A0003','10000','C', 200.00); INSERT INTO "DHK_SCHEMA"."PRODUCT" VALUES ('A0004','10000','D', 100.00); INSERT INTO "DHK_SCHEMA"."PRODUCT" VALUES ('A0005','10000','A', 550.00);
Product Description table Script-
CREATE COLUMN TABLE "DHK_SCHEMA"."PRODUCT_DESC" ( "PRODUCT_ID" NVARCHAR (10) PRIMARY KEY, "PRODUCT_NAME" NVARCHAR (10) ); INSERT INTO "DHK_SCHEMA"."PRODUCT_DESC" VALUES ('A0001','PRODUCT1'); INSERT INTO "DHK_SCHEMA"."PRODUCT_DESC" VALUES ('A0002','PRODUCT2'); INSERT INTO "DHK_SCHEMA"."PRODUCT_DESC" VALUES ('A0003','PRODUCT3'); INSERT INTO "DHK_SCHEMA"."PRODUCT_DESC" VALUES ('A0004','PRODUCT4'); INSERT INTO "DHK_SCHEMA"."PRODUCT_DESC" VALUES ('A0005','PRODUCT5');
Now table “PRODUCT” and “PRODUCT_DESC” is created in schema “DHK_SCHEMA”.
Attribute View Creation
STEP 1) in this step,
- Select SAP HANA System.
- Select content Folder.
- Select Non-Structural Package Modelling under Package DHK_SCHEMA in the content node and right click->new.
- Select Attribute view option.
STEP 2) Now in next window,
- Enter Attribute Name and Label.
- Select View Type, here Attribute View.
- Select subtype as “Standard”.
- Click on Finish Button.
STEP 3) Information view editor screen will open. Detail of each part in Information Editor is as below –
- Scenario Pane: In this pane the following node exists-
- Data foundation
- Detail Pane: In this pane following tab exists –
- View Properties
- Semantics (Scenario Pane): This node represents output structure of the view. Here it is Dimension.
- Data Foundation (Scenario Pane): This node represents the table that we use for defining attribute view.
- Here we drop table for creating attribute view.
- Tab (columns, view Properties, Hierarchies) for details pane will be displayed.
- Local: Here all Local attribute detail will be displayed.
- Show: Filter for Local Attribute.
- Detail of attribute.
- This is a toolbar for Performance analysis, Find column, validate, activate, data preview, etc.
STEP 4) To include database table for creating attribute view, click on data foundation node and follow the instruction step by step as below –
- Drag table “PRODUCT” and “PRODUCT_DESC” from TABLE node under DHK_SCHEMA
- Drop “PRODUCT” and “PRODUCT_DESC” to data foundation node.
- Select field from “PRODUCT” Table as Output In detail pane. Field icon color changes from grey to orange.
- Select field from “PRODUCT_DESC” Table as Output in the detail pane. Field Icon color change from grey to orange.
- The field selected as output from both the table appear Under Column list in Output Pane.
Join “PRODUCT” table to “PRODUCT_DESC” by “PRODUCT_ID” field.
STEP 5) Select Join path and Right Click on It and choose Edit option. A screen for Edit Join Condition will appear
- Select Join Type as Type “Inner”.
- Select cardinality as “1..1”.
After selecting join type click on “OK” button. In next step, we select the column and define a key for output.
STEP 6) In this step, we will select column and define the key for output
- Select Semantic Panel.
- Column tab will appear under Detail pane.
- Select “PRODUCT_ID” as Key.
- Check Hidden option for field PRODUCT_ID_1 (PRODUCT_DESC table field).
- Click on validate Button.
- After successful validation, click on activate Button.
Job Log for validation and activation activity is displayed on bottom of screen on the same page, i.e. Job Log section as below –
STEP 7) An attribute view with name “AT_PRODUCT” will be created. To view, refresh the Attribute View folder.
- Go to DHK_SCHEMA->MODELLING Package.
- AT_PRODUCT Attribute view display under Attribute view folder.
STEP 8) To view data in Attribute view,
- Select data Preview option from the toolbar.
- There will be two option for data view from attribute view –
- Open in Data Preview Editor (This will display data with analysis option).
- Open in SQL Editor. (This will display output as only SQL query Output).
STEP 9) To see View Attribute data in data Preview editor –
There are 3 options – Analysis, Distinct and Raw data
Analysis: This is a Graphical representation of the attribute view.
- By selecting Analysis tab, we select Attributes for Label and Axis format view.
- Drag and drop attribute in label axis, it will display in Label axis(X Axis).
- Drag and drop attribute in value axis, it will display in value axis (Y Axis).
- The output will be available in the format of Chart, Table, Grid, and HTML.
Distinct Values: The distinct value of the column can be displayed here. This will show total no. records for selected attribute.
Raw Data tab: This option display data of attribute view in table format.
- Click on Raw data tab
- It will display the data in table format
STEP 10) View Attribute data in from SQL editor as below –
This option display data through SQL Query from the column view under “SYS_BIC” schema. A column view with name “will created after activation of attribute view “AT_PRODUCT”. This is used to see SQL query used for displaying data from the view.
- Display SQL Query for data selection.
- Display output.
Attribute View when activated, a column view under _SYS_BIC schema is created. So, when we run Data Preview, system select data from column view under a _SYS_BIC schema.
Screen shot of column view “AT_PRODUCT” under “_SYS_BIC” Schema of catalog node is as below –