Using Manual Select Placeholders
This applies to: Managed Dashboards, Managed Reports
You can define a placeholder for a Manual Select transform and use it in your manual queries. A placeholder marks where in the query to insert the value from a parameter, which you can later connect to a filter or script on a dashboard, or set to an attribute value.
Using a Placeholder With SQL
Defining a Placeholder
For this example, create a new data cube and select the Manual Select option.
In the Open dialog, select a SQL Server data connector (e.g., Adventure Works) and click the submit button at the bottom.
In the Script Editor window, enter a parameterized SQL statement where each parameter is enclosed between dollar sign($) characters. Then click Save. For example:
select * from [Sales].[vSalesPerson] where BusinessEntityId = $BEID$
The Placeholders dialog will appear. Click Add placeholder and then change the settings as needed. In our example, we set Identifier to BEID
to match our query.
Select the Public check box to allow this parameter to be set outside the cube. Enter a default value for the parameter (e.g., 274).
Important: When Value Type is Collection, the placeholder is replaced by the query text <element> IN <values>, so set the additional setting Element Name to your column name (e.g., BusinessEntityID). The sample query above would instead be: select* from /Sales]./vSalesPerson] where $BEID$
Click the submit button at the bottom and close the dialogs. A Manual Select and Process Result transform appear on the canvas. Select the Process Result transform and open the Data Preview window. You'll see that the records returned by the manual query have been filtered (e.g., BusinessEntitylD= 274).
Note: Tokens, such as built-in attributes and custom attributes, can be selected as the placeholder parameter's default value only after it's been created by reopening the Manual Select transform and editing its placeholders.
Using the Placeholder on a Dashboard
Next, create a new dashboard to see how to connect this placeholder parameter to a filter control.
Go to the Explore window and expand the data cube that was just created. Drag the SalesYTD measure to the canvas. It will appear as a table visualization. Then drag the FirstName dimension onto the table.
With the table selected, click Filter in the toolbar, and then select Single Number. In the Filter Visualizations panel, select the Business Entity ID item. This is the placeholder that was created earlier.
Finally, switch to View mode to use the filter.
Using a Stored Procedure With a Placeholder
In order to execute a stored procedure in the script editor, you need to uncheck the Enable Subquery Optimization check box in the Manual Select transform configuration.
See Manual Select for details on this option. Alternatively, you can use a Stored Procedure Select instead of executing the stored procedure with your own query in a Manual Select.
Using MDX With a Placeholder
See Passing Placeholder Value From Dashboard to Manual MDX Select
For more information, see:
Comments
0 comments
Please sign in to leave a comment.