When you’d like the user to be able to to run some action directly from within an Analytics Chart (PA Chart), which is displayed either standalone in Data Analyzer menu, or inside a portlet of a dashboard, and this action would need to know the data/query of the chart, you can set up a Contextual Action for the chart.
Configuration
Create a new application property with name “pfxContextualAction_{nameOfYourAction}” with JSON object with fields:
name* (string) - Name of the button (unique within a partition)
labelTranslations (Map) - Test on the action button, provided potentially in several languages. For example
{ "" : "Create Watcher" }
page* (string) - page on which the button should be displayed. It’s a value of constant from AppPages. For example
dataAnalyzerPage
ordashboardPage
.order (integer) - If there are multiple buttons in same page, this can be used to provide specific order. When not specified, ordering is done by labelTranslations.
conditionToShow (string) - Condition expression which decides if the button should be shown. Written in JavaScript, expected to return a boolean. The properties are in the placeholder {}, and will be replaced on front-end code during runtime. Examples of value:
["PAQUERY", "MATRIX"].includes({resultType}) || {result.generatedSavedChart.series.length} > 0
{typedId} != null
["DATATABLE"].includes({chartDefinition.chartType}) && {chartDefinition.series.length > 0}
contextLinking* (Map) - All basic context linking parameters such as targetPage, targetPageEntityType, targetPageInputs, targetPageFields, etc. Read more about Context Linking Parameters. The variables placeholders will be provided from front-end.
Placeholders for page “dashboardPage”
conditionToShow - the placeholders provides you data from the CalculationResult of the logic element, like:
resultType
: string - value of constant from CalculationResultTyperesult
: Map - the actual object returned from the logic element, represented as Map.
contextLinking - the variables will be provided from front-end. Following variables/placeholders can be used:
dashboardName
: String - unique name of the dashboard as defined in dashboard configurationdashboardInputs
: Array<Map> - list of input field names and their values.dashboardTypeddId
: String - ID (with type) of the dashboard. Could be used, for example, in the target page to provide a link back to the original dashboard.dashboardPreference
: Map - user preferences used for displaying the dashboardportletName
: String - name of the portlet is given by the name of the logic element, which provided it's contentportletLabel
: String - label of the portlet is given by the label of the logic element, which provided it's content
Placeholders for page “dataAnalyzerPage”
conditionToShow - the placeholders provides you data from the SavedChart (SC) object, like:
typedId
: string - Id of the SavedChart. This value is null until the chart is actually rendered. For example, you can use it to show the action button only once the chart is rendered.chartDefinition
chartType
series
length
contextLinking - the variables will be provided from front-end. Following variables/placeholders can be used:
queryBuilderState
: MapchartType
: StringchartTypedId
: StringchartLabel
: String