Skip to Content
Author's profile photo Jan Zwickel

Example 2: filter with input parameter on string value

This example is referenced in my other post about input parameters. Please have a look at the other post to get a better understanding of the context for this example

 

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.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.