Previous section   Next section

Executing Client-Side Commands

Executing Client-Side Commands

An action can contain commands to execute when the control returns to the dashboard. To include such commands, set the pContext.command property within the definition of the action. For example:
        //this part defines Action 1
        //perform server-side actions
        //on returning, refresh the widget that is using this KPI 
        Set pContext.command="refresh;"
For pContext.command, specify a string of the following form to execute a single command:
For pContext.command, specify a semicolon-delimited list of commands:
The final semicolon is optional.
Some commands accept one or more arguments. For these, use command:arg1:arg2:... instead of command.

Available Commands

Within pContext.command, you can use the following commands:
Displays the message in a dialog box. message is the message to display
For example:
 Set pContext.command = "alert:hello world!"
For information on the arguments, see “Details for applyFilter and setFilter.”
This command sets the given filter and refreshes the browser window.
For example, the following applies a filter to a pivot table:
 Set pContext.command = "applyFilter:samplepivot:[DateOfSale].[Actual].[YearSold]:&[2008]"
Where url is the URL to display.
This command opens the given URL in the same browser window.
For example:
 Set pContext.command = "navigate:"
Where url is the URL to display.
This command opens the given URL in a new browser window.
For example:
 Set pContext.command = "newWindow:"
Where popupurl is the relative URL of a popup window.
This command displays the given popup window. For example:
 Set pContext.command = "popup:%ZEN.Dialog.fileSelect.cls"
Where widgetname is the optional name of a widget to refresh; if you omit this argument, the command refreshes the widget from which the user launched the action.
This refreshes the browser window, using any current settings for filters.
For example:
 // Refresh the widget that fired this action and another named samplepivot.
 Set pContext.command = "refresh;refresh:samplepivot"
Note that this example includes multiple commands, separated by a semicolon.
For information on the arguments, see “Details for applyFilter and setFilter.”
This command sets the given filter, but does not refresh the browser window.

Details for applyFilter and setFilter

The applyFilter and setFilter commands are as follows, respectively:
  • target is the widget to filter. You can use an asterisk (*) to apply the filter to all widgets.
  • filterSpec specifies the filter value or values to apply to the given target. This must have the following form:
    Where the arguments depend upon the details of the target widget as follows:
    Scenario filter_name filter_values
    Target widget displays a pivot table [dimension].[hierarchy].[level] See “Allowed Default Values for Filters” in the chapter “Configuring Settings.”
    Target widget displays a KPI Name of a filter defined in that KPI One of the allowed values for this filter, as defined in the KPI
    • You can use multiple filter specifications; to do so, separate them with a tilde (~). For example:
    • The filter name and filter values are not case-sensitive for pivot tables or for KPIs that use MDX queries.
    • The filter can affect only widgets that have been configured with a filter control (possibly hidden) that uses the same filter. For example, suppose that a widget includes a Cities filter control, and has no other filter controls. If the action filters to a city, the widget is updated. If the action filters to a ZIP code, the widget is not updated.
Previous section   Next section