In the previous blog in this series, we learnt how to incorporate popups in analytic applications. In this blog, let us look at another common feature of analytic applications – dynamic visibility.

* * *

Our objective here is to enable the end user toggle between a table & a chart using a radio button group dynamically during runtime. The final application would look as follows:

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

Dynamic Visibility in Analytic Applications

 

Following are the steps to set up dynamic visibility. (Note that we continue to use the same application that we leveraged earlier)

1. Add a Radio Button Group

Select the Radio Button Group from the insert menu.

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

Adding a radio button group

Place the Radio Button Group on top right corner of the chart. You can see the default values arranged vertically.

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

placing the radio button in the canvas

 

2. Configure Radio Button Group

You can change the values – Value1 and Value2 – to Chart & Table in the Builder panel. Set the ‘Chart’ value as default.

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

configuring the radio button group

Change the display option to Horizontal in Styling Panel.

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

Styling options for radio button group

The Radio Button Group is now configured accordingly.

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

 

3. Add a Table

Before adding the table, hide the chart on the main canvas so that it is easier to position the table. To do this, use the option ‘Hide’ under context menu of the widget in the outline view. Please note that this option hides the chart only during design time – the end user will still be able to view the chart during runtime.

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

hiding the chart before adding the table

Now add a table and place it in the desired position in the canvas. Make sure that the table widget is below the radio button group in the outline view – so that the radio button group always stays visible. Finally, map the table to your data.

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

Adding the table to the canvas

 

4. Hide the Table by default

When the user runs the application, you do not want the user to see the table by default. To achieve this, unselect the option “Show this item at view time” from the Styling panel.

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

Hiding the table by default

Since we have the Radio Button Group on the top right corner, it is advisable to hide the table’s Context/Quick Menus from the end user to avoid confusion. This can be done from the Styling panel. Note that you may also hide functions such as Filter, Sorting or Ranking selectively.

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

Hiding the table’s context menus

 

5. Add Toggle Functionality (Using Scripting)

Now that the setup is complete, add the following toggle functionality to the onSelect() event of Radio Button Group.

If (RadioButtonGroup_1.getSelectedKey() === “Chart”) {

                Chart_State_Sales.setVisible(true);

                Table_Details.setVisible(false);

} else {

                Chart_State_Sales.setVisible(false);

                Table_Details.setVisible(true);

}

SAP Analytics Cloud – Application Design Series: 4 – Dynamic Visibility

Script for adding toggle functionality

Save & run the analytic application. You will be able to toggle between chart and table.

* * *

In the subsequent blog we will explore how to leverage Scripting in analytic applications.

Reach out to us here today if you are interested to evaluate if SAP Analytics Cloud is right for you.

Subscribe to our Newsletter

5920 Windhaven Pkwy
Plano TX 75093.

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com