Script Based Calculation View in COPA Scenario_Part 4
Previous Blogs in COPA Scenario.
Script Based Calculation View
Calculation Views are used to create data foundation using database tables, Attribute Views, Analytic Views, and Calculation Views to address a complex business requirement. If joins are not sufficient, we create a calculation view with SQLScript. Also Calculation Views are required if the columns span across tables. A Calculation View is a composite column view visible to the reporting tools. When the view is accessed a function is implicitly executed.
Calculation views are composite views used on top of analytical and attribute views.
Calculation views are defined as either graphical views or scripted views depending on how they are created.
Graphical views can be modeled using the graphical modeling features of the SAP HANA Modeler. Scripted views are created as sequences of SQL statements.
Below are the steps for creating Script Based Calculation View
1. Create a Script based Calculation View.
Right click on Calculation view > New > Calculation View.
2. As result following screen appears.
3. In the left side of the diagram double click on the Script Node. Before entering code into the middle section click on the structure icon within the Outputs section in the right side of the screen.
4. Enter all the output fields accordingly, including the corresponding Data Type and Length.
5. Write down the SQL code statements between BEGIN & END.
6. Click on the Output Node in the Scenario on the left hand side. Within the Script View details select all the Attributes > Right Click > Add as Attribute to move the fields into the outputs over to the right hand side of the screen.
7. Final Steps