Example 2: filter with input parameter on string value
We will use IP_1 to filter for product oranges. As we will filter for strings the documentation tells us to use apostrophes around the input parameter when calling the Calculation View:
placeholder.”$$IP_1$$”=>’oranges’
which intuitively makes sense as we are dealing with a string input parameter
Accordingly, the filter expression needs apostrophes as well because there is nothing to be evaluated and the value of the input parameter should be treated as a string:
“product”= ‘$$IP_1$$’
To create this example:
a) Change the input parameter from Example 1 to NVARCHAR(20) (see screenshot below)
b) Change the filter to
“product”= ‘$$IP_1$$’
c) Save, build and preview the Calculation View
d) When asked for a value for IP_1 enter oranges
In the results you will only see records with oranges in column product. The generated query looks like expected:
SELECT TOP 1000
“date”,
“product”,
SUM(“productRating”) AS “productRating”,
SUM(“amount”) AS “amount”
FROM “INPUTPARAMETERS_HDI_DB_1”.”inputParameters.db::example2″
(placeholder.”$$IP_1$$”=>’oranges’)
GROUP BY “date”, “product”;
Click here to navigate back to the context in which this example is discussed. You will also find further examples there.