Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

Create bookmarks programatically / Get Spotfire username

from Spotfire.Dxp.Application import BookmarkComponentFlags  
from Spotfire.Dxp.Application.AnalyticItems import BookmarkManager

#define name of bookmark (make sure is unique)
bookmarkName = "myBookmark"

#create the bookmark. Second argument specifies what to capture
myBookmark = Document.Bookmarks.AddNew(bookmarkName ,BookmarkComponentFlags.FilterSettings)

#extract data from myBookmark (last bookmark in our collection)
print Document.Bookmarks[Document.Bookmarks.Count-1].CreatedBy

#loop bookmarks
bookmarkManager = Application.Document.Context.GetService(BookmarkManager)
for b in bookmarkManager.GetBookmarks():
   print b.Name

#search bookmarks (assuming that bookmark exists)
myBookmark = bookmarkManager.Search('name::"myBookmark"')[0]

#apply a bookmark
components = BookmarkComponentFlags.PageConfiguration | BookmarkComponentFlags.FilterOrganization
bookmarkManager.Apply(my
Bookmark, components)

#delete bookmark
Document.Bookmarks.Remove(myBookmark)

#update bookmark
bookmarkManager.Update(myBookMark)

No comments: