How to fetch a list of various library items.

How to fetch a list of various library items.

book

Article ID: KB0081336

calendar_today

Updated On:

Products Versions
Spotfire Analyst All versions

Description

A list of various library items such as Analyses, Information links, procedures, .sbdf files etc. can be identified from the library using an IronPython Script.

Issue/Introduction

How to fetch a list of various library items.

Environment

All Supported OS versions

Resolution

Below is a sample IronPython snippet which can be used to find a list of all the analyses present in the library:

########################################
#Snippet to find a list of DXPs available in library

from Spotfire.Dxp.Framework.Library import LibraryManager, LibraryItem, LibraryItemRetrievalOption

libraryManager = Application.GetService[LibraryManager]() 
result = libraryManager.Search("item_type: dxp", LibraryItemRetrievalOption.IncludePath);
for item in result:
 print item.Title.ToString();

#########################################

Note: The syntax used as the Search Expression ("item_type: dxp") is the same as in the search field in the "Open from Library" dialog. See the topic "Searching the Library" in the TIBCO Spotfire User's Guide for a description of the search syntax. For example: if you change the item type to query ("item_type: query"), it can be used to fetch a list of ILs present in the library.

You can run the script directly in the Edit script dialog box and it will fetch the list in the Output panel.

Disclaimer: The script code in this article is only a sample to be used as a reference. It is not intended to be used "As Is" in a Production environment. Always test in a Development environment. Make modifications to the script in accordance with your implementation specifications that best suit your business requirements. Refer to the API reference(s) cited in this article for usage of the classes and methods used in the script.

Additional Information

https://docs.tibco.com/pub/sfire-analyst/7.13.0/doc/html/en-US/TIB_sfire-analyst_UsersGuide/lib/lib_searching_the_library.htm

https://docs.tibco.com/pub/doc_remote/spotfire/7.9.0/TIB_sfire-analyst_7.9.0_api/html/T_Spotfire_Dxp_Framework_Library_LibraryManager.htm