Databases Reference
In-Depth Information
Creating an input parameter is a simple affair—as usual, in the
Output
pane of our analytic view,
click on the
Input Parameters
node, then
New
to see the
Input Parameters
dialog, as shown in
the following screenshot:
Here, we'll create a parameter called
SALES_INCREASE_PERCENT
, which is mandatory (the
user will have to enter a value to be able to see the results of the view).
Because we'll be asking the user for an increase in percentage, we'll not define a type for the
variable. The
Type
field indicates to SAP HANA the kind of data we'll be asking for —either an
attribute value, a currency, a date, or a list of accepted values from which the user can choose.
We'll be asking for none of these—we just want the user to enter a number, so leave the
Type
field empty. The
Data Type
field, however, will contain an
INTEGER
value; SAP HANA will use
this information to validate that the user enters a valid value, and because it's a number, we'll be
able to use it later in calculations.
If you save the variable, activate the view, and request a data preview, you
will obtain the same results as we saw earlier. Even though we defined our
variable as
Is Mandatory
, we were not asked to input any value. The reason
for this is quite simple—the variable exists, but it is not yet used anywhere. As
soon as we integrate the variable in our view, we'll be asked to input a value.
Calculated Measures
Now that we have a variable, which the user can fill in, we can use this to create our projected
sales total.
To store this amount, we need a new column in our view, and this column will be a measure,
just like
ORDER_AMOUNT
. However, because this information is not present in any underlying
table, it is called a calculated measure. Every time we ask SAP HANA for the contents of our
view, this column will be recalculated.