Skip to main content

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:

command1

For pContext.command, specify a semicolon-delimited list of commands:

command1;command2;command3;...;

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:

alert
alert:message

Displays the message in a dialog box. message is the message to display

For example:

 Set pContext.command = "alert:hello world!"
applyFilter
applyFilter:target:filterSpec

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]"
navigate
navigate:url

Where url is the URL to display.

This command opens the given URL in the same browser window.

For example:

 Set pContext.command = "navigate:http://www.google.com"
newWindow
newWindow:url

Where url is the URL to display.

This command opens the given URL in a new browser window.

For example:

 Set pContext.command = "newWindow:http://www.google.com"
popup
popup:popupurl

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"
refresh
refresh:widgetname

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.

setFilter
setFilter:target:filterSpec

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:

applyFilter:target:filterSpec

And:

setFilter:target:filterSpec

Where:

  • 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:

    filter_name:filter_values
    

    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 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

    Notes:

    • You can use multiple filter specifications; to do so, separate them with a tilde (~). For example:

      FILTER:filterspec1~filterspec2
      
    • 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.

FeedbackOpens in a new tab