B1H Variables
B1H Variables
1
At the end of this course, you will be able to describe how to create variables and input
parameters.
For query views, you can variables and input parameters to get data from report users.
Variables are bound to attributes and are used for filtering. As such, they can only contain the
values available in the attribute they relate to.
Input parameters can contain any value the reporting user want to enter. Therefore, a data type
for the input parameter must be specified.
§ You use variables to filter data at runtime. You assign values to these variables by entering
the value manually, or by selecting it from the drop-down list.
§ Using variables means that you do not need to decide on the restriction on the value of
attributes at the design time.
§ If a calculation view is created using an analytic view with variables, those variables are also
available in the calculation view but cannot be edited.
The following types of variables are supported:
Single Value: use this to apply a filter to a single value.
Interval: use this where you want the user to specify a set start and end to a selected interval.
Range: Use this when you wan the end user to be able to use operators such as “Greater Than”
or “Lesser Than”
A variable restricts the results in the view for the selected attribute. To create a variable, select
the attribute in the view that you want to filter on, then define the following values:
Selection Type: You can choose whether selections should be based on intervals, ranges or
single values.
Multiple Entries: You control whether multiple values of the selection types should be allowed.
Default Value: You have the option to define a default value for the variable.
You might want to take input from the user and process it, returning dynamic data based on the
user selection.
You would like to use the same query to run aging for accounts receivable or vendor liabilities.
You can use an input parameter for Business Partner Type to allow the report user to make this
decision when running the report.
When running the report the user could choose Customer or Vendor.
When creating an input parameter definition, first add a name and give it a descriptive label.
Choose a suitable parameter type, for example a StaticList type. We used this type for the
input parameter for our Aging Query because the value of this parameter will come from a user-
defined list of values.
You have the option to define whether a parameter is mandatory. You also can set a default
value. In this case, we have chosen to set a constant value of C.
Input parameters must have a data type defined because they are not directly associated with
an attribute unlike variables.
In this example we chose to have a static list with values that the user can choose, therefore we
entered the values”Customer” or ”Vendor” in a list of values.
Create a Variable to filter the NetSales by year
q Run the Data Preview, you will be prompted to enter a YEAR before the view is executed.
11
We are going to calculate the commission charges based on an input parameter: %
commission.
Add an Input Parameter to your Query view where the user will enter a % commission on sales:
q Create the Input Parameter:
q Type – Decimal (21,6)
12
§ Variables are bound to attributes and are used for filtering.
§ As such, they can only contain the values available in the attribute they relate to. You do
not need to decide on the restriction on the value of attributes at the design time.
§ Input parameters are more flexible. They can contain any value the reporting user want to
enter.
14
15