* * *
Bookmarking enables you to save the current state of an application for later use. All the user selections and filters will be retained in the Bookmark while the data can be refreshed. Let us see how to build a Bookmarking feature within Analytics Designer.
Adding Bookmark Set
Bookmark Set is a scripting widget in Analytics Designer that enables Bookmarking functionality for scripting. You can only add one Bookmark set. You can rename and change the version of the Bookmark set. You will also be able to configure the components to be included when saving a Bookmark. When you make any new changes to the Analytic Application and you want to avoid invalid Bookmarks, then increase the version number so that you can start over with a new set of Bookmarks.
Bookmark Script Functions
Script Functions for saving, deleting and getting all Bookmarks are available for the Bookmark Set.
Let us see in detail how to configure a Bookmark functionality as shown below.
1. Setting up the Widgets
As a first step, you need to add the necessary widgets to the canvas. Here the application has two charts and two filter options (dropdown and radio-button group). A button is added to open a popup which needs to be configured with various Bookmark functionalities.
A popup is added along with widgets like Input Field, Radio-button Group, Dropdown and Buttons. On the left side of the popup, end-user will be able to save the current state of the application as a new Bookmark. You also have the option to choose whether to save a personal or global Bookmark. On the right side of the popup, end-user can open or delete a Bookmark. An existing Bookmark can be overwritten with the current state as well. Another radio-button is used on the right side to switch between personal and global Bookmarks loaded in the dropdown.
2. Add New Bookmark
The function save() is used to create a Bookmark. The arguments are the name of the Bookmark, global flag and overwrite flag. Here the below script is added to the onClick event of a button to create a new Bookmark.
Here in the script, the name of the Bookmark is obtained from the Input Field. The global flag value is obtained from a script variable which is updated by the radio-button selection within the popup. Once the Bookmark is created, a global script function is called to load existing Bookmarks in the dropdown and then the popup is closed.
3. Load Existing Bookmarks
List of all existing Bookmarks can be obtained using the function getAll(). Then each Bookmark object can be accessed to obtain details like a global flag, id, name, etc. using script functions. Here the below script is added to a global script function to populate all existing Bookmarks to the dropdown.
4. Overwrite and Delete Bookmarks
The following script of the Overwrite and Delete Buttons gets the ID of the selected Bookmark from the dropdown and then utilizes the function save() and deleteBookmark() to implement the functionality. For overwriting, the same name of the Bookmark is used in save() function along with the overwrite flag argument which is set to true.
5. Access Bookmarks
There is no script function available to directly load an existing Bookmark within an Analytic Application. All the existing Bookmarks can be accessed from the main menu.
It lists the Bookmarks created from all the Analytic Applications. You can select a Bookmark to open the application with the saved state. Information like name of the application, type, owner, status, etc. are displayed. You can also directly edit, share or delete the Bookmarks.
You can also access Bookmarks specific to an application using context menu within Files Repository.
Apart from the above-mentioned ways, a workaround can be implemented within the Analytic Application to load an existing Bookmark. You can append the Bookmark ID to the URL of the Analytic Application and use the navigation utility function to load the URL in the same tab. The following script is added to the onClick event of the Open button within the popup to load the URL of the Bookmark.