Skip to main content

Available Context Information

Available Context Information

An action can use context information — values from the dashboard, based on the row or rows that the user selected before launching the action. These values are useful if you want to cause changes in the database that are dependent on context.

Because %OnDashboardAction() is a class method, you do not have access to %seriesNames or other properties of the KPI class from within this method. Instead, the system provides the pContext variable, which is an object whose properties provide information for use in the action. The details are different in the following scenarios:

Scenario: Pivot Table Widget with Pivot Table as Data Source

In this scenario, within the %OnDashboardAction() method, the pContext object contains the properties described in the following table. As noted, the contents of the pContext object vary depending on whether the widget is displaying the pivot table itself (pivot mode) or a listing (listing mode).

Property Name Contents in Pivot Mode Contents in Listing Mode
currValue Value of first selected cell Value of the first selected cell that was displayed before the listing was shown
currSeriesNo Column number Column number of the first selected cell that was displayed before the listing was shown
currItemNo Row number Null
currFilterSpec MDX %FILTER clause or clauses that represent the filtering applied to the current cell context. This includes values of any filter controls, as well as the row and column context. Null
valueList Null Comma-separated list of values from the first column of the listing (these values must not contain commas)
cubeName Name of the cube queried by this pivot table Null
mdx MDX query defined by this pivot table Null
pivotVariables A proxy object that contains one property for each pivot variable. Specifically, pContext.pivotVariables.varname contains the value of the pivot variable varname. In this proxy object, all pivot variable names are in lowercase. For example, if the server defines a pivot variable named MyVar, this pivot variable is available as pContext.pivotVariables.myvar Same as in pivot mode
filters An array that indicates the current values of the filter controls which are currently active. The subscript for each node in the array is the MDX expression for the filter. The value of the node is the corresponding key or keys, in the form described at Allowed Default Values for Filters. Same as in pivot mode
dataSource Name of the current data source Name of the current data source

Scenario: Pivot Table Widget with KPI as Data Source

In this scenario, within the %OnDashboardAction() method, the pContext object contains the properties described in the following table. As noted, the contents of the pContext object vary depending on whether the widget is displaying the pivot table itself (pivot mode) or a listing (listing mode).

Property Name Contents in Pivot Mode Contents in Listing Mode
currValue Value of first selected cell Value of the first selected cell that was displayed before the listing was shown
currSeriesNo Column number Column number of the first selected cell that was displayed before the listing was shown
valueList Null Comma-separated list of values from the first column of the listing (these values must not contain commas)
pivotVariables A proxy object that contains one property for each pivot variable. Specifically, pContext.pivotVariables.varname contains the value of the pivot variable varname. In this proxy object, all pivot variable names are in lowercase. For example, if the server defines a pivot variable named MyVar, this pivot variable is available as pContext.pivotVariables.myvar Same as in pivot mode
filters An array that indicates the current values of all filter controls. Each node in the array corresponds to one of the filters defined by the data source KPI. The subscript for each node in the array is the name of the filter, as specified in the KPI definition class. The value of the node is the key or keys currently selected for that filter, in the form described in Allowed Default Values for Filters. If no keys are selected for a filter, the value of the corresponding node is null. Same as in pivot mode
dataSource Name of the current data source Name of the current data source

Scenario: Scorecard with Pivot Table or KPI as Data Source

For scorecards, the contents of the pContext object within the %OnDashboardAction() method are mostly the same regardless of whether the data source is a pivot table or a KPI. The following table describes the contents of pContext for a scorecard, noting where there are variations depending on the data source:

Property Name Contents with Pivot Table as Data Source Contents with KPI as Data Source
currValue Value of the pivot column that is marked as Value Column in this scorecard Value of the KPI property that is marked as Value Column in this scorecard
currSeriesNo Row number Same as when the data source is a pivot table
valueList Value of the pivot column that is marked as Value Column in this scorecard Value of the KPI property that is marked as Value Column in this scorecard
pivotVariables A proxy object that contains one property for each pivot variable. Specifically, pContext.pivotVariables.varname contains the value of the pivot variable varname. In this proxy object, all pivot variable names are in lowercase. For example, if the server defines a pivot variable named MyVar, this pivot variable is available as pContext.pivotVariables.myvar Same as when the data source is a pivot table
filters An array that indicates the current values of the filter controls which are currently active. The subscript for each node in the array is the MDX expression for the filter. The value of the node is the corresponding key or keys, in the form described at Allowed Default Values for Filters. An array that indicates the current values of all filter controls. Each node in the array corresponds to one of the filters defined by the data source KPI. The subscript for each node in the array is the name of the filter, as specified in the KPI definition class. The value of the node is the key or keys currently selected for that filter, in the form described in Allowed Default Values for Filters. If no keys are selected for a filter, the value of the corresponding node is null.
dataSource Name of the current data source Same as when the data source is a pivot table
FeedbackOpens in a new tab