Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to prevent creation of multiple Bookmarks with the same name

In the Document OnOpen triggers, I added an action to create a bookmark named with the user's network ID. There is a tab in which the users can make their selections which will be saved under that bookmark. But the problem is, every time a user opens the file, another bookmark is being created with the same name. The list keeps adding up. How can this be prevented?

5 Replies
settu_periasamy
Master III
Master III

Hi,

After creating the bookmark (once), you can try to replace the bookmark using trigger.

Not applicable
Author

I wish it were that simple since that is exactly what I want to do : create the book mark exactly once - how to check if a bookmark with a given ID / Name exists? Then I can use that code to either create or replace it.

settu_periasamy
Master III
Master III

do you want to know which bookmark id is created?

You can check it  'More' option in the Bookmark Menu

Not applicable
Author

I already know which bookmark ID is created because I am programmatically creating it using the same variable name (vNTUser which in turn depends upon the logged in user) for both Bookmark ID and Bookmark Name. I need to prevent the creation of bookmarks repeatedly with the same name. I need a code segment to perform the following:

  • If Bookmark with name/ID "XYZ" exists, Replace Bookmark with current selections.
  • If not - Create Bookmark with name/ID "XYZ"

I have found this macro code on the web which is not working as expected. Is there any help document for QLIKVIEW VBScript?

Sub BM2
selected_model = ActiveDocument.Evaluate("getfieldselections(BMark)")
ActiveDocument.ClearAll false
ActiveDocument.RecallDocBookmark selected_model
End Sub

settu_periasamy
Master III
Master III

there is API guide for macro..

Where to find latest API guide

t‌ry with

ActiveDocument.ClearDocBookmarks

or

ActiveDocument.RemoveBookmarkById "BM01"