Product Information
How to use Linked Analysis with Custom Widget
Starting from QRC Q3 2023 release, Custom Widget can support Linked Analysis as the same way with SAP Analytics Built-in Charts and Table.
In this blog I will explain how you can enable the Linked Analysis with Custom Widget in 3 different Scenarios.
Scenario 1: Custom Widget as a receiver
For this Scenario, no additional steps are required for the Custom Widget developer, as the Linked Analysis functionality is automatically enabled.
Scenario 2: Custom Widget as the driver: without “Filter on Data point Selection”
Same thing as the first Scenario, the Custom Widget developer does not need to take any further action, as the Linked Analysis feature is automatically enabled. However the Story Designer can add buttons to set and remove dimension filter.
Scenario 3: Custom Widget as the driver: with “Filter on Data point Selection”
For this Scenario the Custom Widget developer is requested to add some new line of script in the resource files.
first of all indicate the support of Linked Analysis in the contribution JSON file as follows:
“supportsLinkedAnalysisFilterOnSelection”: true
To update or remove the Linked Analysis filter based on data point selection, use the DataBinding APIs in the Web Component file:
- Apply ‘setFilters’ to modify a Linked Analysis filter when a data point is selected
- Employ ‘removeFilters’ to clear the filter when a data point is chosen
You can refer to the ‘Script API’ below for further details about the newly introduced API:
LinkedAnalysis {
setFilters(selections: Selection | Selection[]): void
removeFilters(): void
}
// samples:
// 1. update data point selection filter with Selection
// const selection = {
// "Location_4nm2e04531": "[Location_4nm2e04531].[State_47acc246_4m5x6u3k6s].&[SA2]",
// "Product_3e315003an": "[Product_3e315003an].[Product_Catego_3o3x5e06y2].&[PC2]"
// };
// this.dataBindings.getDataBinding().getLinkedAnalysis().setFilters(selection);
// 2. update data point selection filter with Selection[]
// const selections = [{
// "Location_4nm2e04531": "[Location_4nm2e04531].[State_47acc246_4m5x6u3k6s].&[SA1]",
// "Product_3e315003an": "[Product_3e315003an].[Product_Catego_3o3x5e06y2].&[PC4]"
// },
// {
// "Location_4nm2e04531": "[Location_4nm2e04531].[State_47acc246_4m5x6u3k6s].&[SA2]",
// "Product_3e315003an": "[Product_3e315003an].[Product_Catego_3o3x5e06y2].&[PC2]"
// }];
// this.dataBindings.getDataBinding().getLinkedAnalysis().setFilters(selections);
// 3. Remove data point selection filters
// this.dataBindings.getDataBinding().getLinkedAnalysis().removeFilters();
Stay Tuned for further new functionalities with Custom Widget !