In the previous blog in this series, we learnt about building a Responsive Layout. In this blog, let us learn about utilizing the Timer Widget and exporting the application to PDF.

* * *

Timer Widget

A timer can be useful in various scenarios like dynamically showing content with a time interval, creating animations for showing an alert, showing reminders about session timeout, etc. A timer is a scripting widget that can be added within the Outline panel in Analytics Designer. You can add multiple Timer widgets as per need. Once the timer is added, script functions are used to start, stop and check the current status. For starting the Timer, you need to mention the time out in seconds. After time out, the Timer automatically stops, and the script mentioned within the timeout event will be executed once. Please note that the function Timer.start() will accept any number where decimals represent the milliseconds. Also, you need to start the Timer again within an onTimeout event if you need to have a continuous loop.


Timer Technical Component

Timer in Action

In the following example, the KPI Summary Chart is refreshed every 2.5 seconds by switching to the next region.


Timer in Action


The Timer is started in onInitialization event with 2.5 seconds as time out period. The following script is added in the onTimeout event of the Timer widget for the dynamic display of KPI Summary.


onTimeout event Script


The while loop finds out the next region in the list and assigns it to a script variable. If the current region is the last one in the list, then the first region value is assigned to the script variable using the if condition. Then a region filter is added to the chart based on the script variable value. At last, the timer is started again to have a continuous loop.

Export to PDF Widget

Export to PDF is also a scripting widget. You can only add one Export to PDF widget which can then be used to export the application view. Properties like Orientation, Paper Size, Page Number Location, Exported File Name can be configured for Export to PDF. You also have the option to enable Header, Footer, Appendix and Comments. You can enter a Custom Name for both Header and Footer and also have the option to Include Date within Header and Appendix.


Export to PDF scripting


In the following example, various properties of the Export to PDF widget are changed and then the PDF is exported.


PDF export Scripting Options


You can see the export to PDF in action below.


Export to PDF in action


In the next blog, we will discuss planning script functions. Click here to evaluate if SAP Analytics Cloud is right for you. To know about the Analytic Applications of SAP Analytics Cloud, please check out our blog series here.

Subscribe to our Newsletter

5920 Windhaven Pkwy
Plano TX 75093.

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192