SAP Knowledge Base Article - Public

3548986 - Issue with Application.setActivePage in Chart.onSelect in SAP Analytics Cloud

Symptom

  1. Apply Application.setActivePage in Chart.onSelect. 
  2. After page is switched, you will need to click on '<' twice on the toolbar to go to previous page.

Environment

SAP Analytics Cloud

Reproducing the Issue

  1. Click on Table in Page1, it goes to Page2, click on "<" to go back Page1, succeeded.
  2. Click on Chart in Page1, it goes to Page2, click on "<" to go back Page1, failed.
  3. On second click "<" on Page 2, succeeded.

Cause

The .onSelect event of the Chart widget is triggered every time a selection changes, including when a selection is cleared.

When switching back to the previous page, the selection of the chart is cleared due to the page switch. This triggers the .onSelect event of the chart again, resulting in a return to the same page.

Resolution

To resolve this issue, add a condition to check if the selection is empty or not. Use the following script:

if (this.getSelections().length > 0) {    Application.setActivePage(Page_2);}

In this way, the page switch only occurs if there is an active selection.

See Also

Your feedback is important to help us improve our knowledge base.

Keywords

SAP Analytics Cloud, Page Navigation, onSelect Event, Chart Widget, Script, Selection Change, Active Selection. , KBA , LOD-ANA-UNS-SCR , Unified Story Scripting related Issues , Problem

Product

SAP Analytics Cloud all versions