• No results found

Using Attribute Views

6 Creating Information Views and Previewing its Output

6.2 Using Attribute Views

Attribute views are used to model an entity based on the relationships between attribute data contained in multiple source tables.

In attribute views you define joins between tables and select a subset or all of the table's columns and rows.

The rows selected can also be restricted by filters. One application of attribute views is to join multiple tables together when using star schemas, to create a single dimension view. The resultant dimension attribute view can then be joined to a fact table via an analytic view to provide meaning to its data. In this use case, the

attribute view adds more columns and also hierarchies as further analysis criteria to the analytic view. In the star schema of the analytic view, the attribute view is shown as a single dimension table (although it might join multiple tables), that can be joined to a fact table. For example, attribute views can be used to join employees to organizational units which can then be joined to a sales transaction via an analytic view

You can create hierarchies to arrange the attributes hierarchically. Hierarchies helps you to visualize and analyze the data in a hierarchical fashion. You can create Level hierarchies and Parent Child hierarchies by specifying the attributes that correspond to different levels, and parent child nodes respectively.

Related Information

Create Attribute Views [page 45]

6.2.1 Create Attribute Views

You can create a view that is used to model descriptive attribute data by using attributes, that is data that does not contain measures. Attribute views are used to define joins between tables and to select a subset or all of the table's columns and rows.

Prerequisites

You have imported SAP system tables T009 and T009B tables of type Time to create time attribute views.

Procedure

1. Launch SAP HANA studio.

2. In SAP HANA System view, expand the content node.

3. In the navigator, select a package where you want to create the new calculation view.

4. In the context menu of the package, select New Attribute View 5. Provide name and description.

6. In the Subtype dropdown list, select the type of the attribute view.

7. Choose Finish.

8. Add data sources.

a. Select the data foundation node.

b. In the context menu, choose Add Objects.

c. In Find Data Sources dialog, enter the name of the data source and select it from the list.

Note

You cannot add column views to the Data Foundation.

d. Choose OK.

Note

You can to add the same table again in Data Foundation using table aliases in the editor.

9. Define output columns.

a. Select the data foundation node.

a. In the Details pane, select the columns that you want to add to the output of the data foundation node.

b. In the context menu, choose Add To Output.

Note

If you want to add all columns from the data source to the output, in the context menu of the data source, choose Add All To Output.

10. Hide attributes in reporting tools.

If you want to hide the attributes form the client tools or reporting tools when you execute the attribute view, then

a. Select the Semantics node.

b. Choose the Columns tab.

c. Select an attribute.

d. Select the Hidden checkbox.

11. Define key attributes.

You need to define at least one attribute as a key attribute. If ther are more than one key attribute, all the key attributes must point to the same table, also referred to as the central table, in the data foundation.

a. Select the Semantics node.

b. Choose the Columns tab.

c. Selet an attribute.

d. Select the Key checkbox.

e. In the Attributes tab page of the Column pane, select the required attribute and select the Type as Key Attribute.

Note

For auto generated time attribute views, the attributes and key attributes are automatically assigned.

12. Activate the attribute view.

○ If you are in the SAP HANA Modeler perspective:

Save and Activate - to activate the current view and redeploy the affected objects if an active version of the affected object exists. Otherwise only current view gets activated.

Save and Activate All - to activate the current view along with the required and affected objects.

Note

You can also activate the current view by selecting the view in the SAP HANA Systems view and choosing Activate in the context menu. The activation triggers validation check for both the client side and the server side rules. If the object does not meet any validation check, the object activation fails.

○ If you are in the SAP HANA Development perspective:

1. In the Project Explorer view, select the required object.

2. In the context menu, select Team Activate .

Note

The activation triggers the validation check only for the server side rules. Hence, if there are any errors on the client side, they are skipped and the object activation goes through if no error found at the server side.

13. Assign Changes

a. In the Select Change dialog, either create a new ID or select an existing change ID that you want to use to assign your changes.

b. Choose Finish.

For more information on assigning changes, see chapter SAP HANA Change Recording of the SAP HANA Developer Guide.

14. Choose Finish.

Results

Restriction

The behavior of attribute views with the new editor is as follows:

● Consider that you have added an object to the editor and the object was modifed after it was added. In such cases, it is recommended to close and open the editor. The helps reflect the latest changes of the modified object in the edior. For more information, see SAP Note 1783668 .

Next Steps

After creating an attribute view, you can perform certain additional tasks to obtain the desired output. The table below lists the additional tasks that you can perform to enrich the attribute view.

Table 10:

Requirement Task to Perform

If you want to filter the output of data foundation node. Filter Output of Data Foundation Node.

Table 11: Working With Attributes

Requirement Task to perform

If you want to create new output columns and calculate its values at runtime using an expression.

Create Calculated Columns

If you want to assign semantic types to provide more meaning to attributes in the attribute views.

Assign Semantics

If you want to create level hierarchies to organize data in reporting tools. Create Level Hierarchies If you want to create parent-child hierarchies to organize data in reporting tools. Create Parent-Child Hierarchies

Table 12: Working With Attribute View Properties

Requirement Task to perform

If you want to filter the view data either using a fixed client value or using a session client set for the user.

Filter Data for Specific Clients

If you want to execute time travel queries on attribute views. Enable Information Views for Time Travel Queries

If you want to invalidate or remove data from the cache after specific time intervals. Invalidate Cached Content If you want to maintain object label texts in different languages. Maintain Modeler Objects in Multi­

ple Languages

If you do not recommend using an attribute view. Deprecate Information Views

Related Information

Filter Data for Specific Clients [page 150]

Enable Information Views for Time Travel Queries [page 152]

Invalidate Cached Content [page 153]

Maintain Modeler Object Labels in Multiple Languages [page 154]

Quick Reference: Information View Properties [page 155]

Preview Information View Output [page 97]

6.2.2 Attribute View Types

SAP HANA modeler supports three types of attribute views. The below table provides information on attribute view types.

Table 13:

Attribute View Type Description

Standard A standard attribute view with table attributes.

Time An attribute view with time characteristics.

You can select the calendar type as Fiscal or Gregorian and model time attribute views.

In addition, you can also auto-create time attribute views. When you select, auto-create, modeler auto-creates these attribute views based on the default time tables. It also defines the appropriate columns or attributes based on the granularity, and creates the required fil­

ters.

Derived Create an attribute view that is derived from an existing attribute view. You cannot modify derived attribute views. It only acts as reference to the base attribute view from which it is derived.

Derived attribute views are read-only. The only editable value is the description of the attrib­

ute view.

Note

The tables used in time attribute views for calendar type Gregorian are, M_TIME_DIMENSION, M_TIME_DIMENSION_ YEAR, M_TIME_DIMENSION_ MONTH, M_TIME_DIMENSION_WEEK and for calendar type Fiscal is M_FISCAL_CALENDAR. If you want to do a data preview for the created attribute view, you need to generate time data into tables from the Quick View.