Jump to content
  • How to find where the current analysis was loaded from, etc. in Spotfire® Using IronPython Scripting


    This article contains script of how to find where the current analysis was loaded from, etc. in Spotfire® Using IronPython Scripting

    Introduction

    There is metadata available containing information about where the file was loaded, what filename was used, and what filename will be used when saving again.

    Code Sample

    # Copyright © 2020. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    # Since you cannot both have a file loaded from Library and from File, some of the properties will always be null below and throw exceptions.
    # If file haven't been loaded from library or filesystem (i.e new file) all of the properies below will be null.
    
    try:
    	print "LoadedFromFileName: " + Application.DocumentMetadata.LoadedFromFileName
    except Exception,err:
    	print(err.ToString(),"Exception")
    
    try:
    	print "LoadedFromLibraryItem: " + Application.DocumentMetadata.LoadedFromLibraryItem.Title + ', ' + Application.DocumentMetadata.LoadedFromLibraryItem.Path
    except Exception,err:
    	print(err.ToString(),"Exception")
    
    try:
    	print "LoadedFromLibraryPath: " + Application.DocumentMetadata.LoadedFromLibraryPath
    except Exception,err:
    	print(err.ToString(),"Exception")
    
    try:
    	print "FileNameUsedBySave: " + Application.DocumentMetadata.FileNameUsedBySave
    except Exception,err:
    	print(err.ToString(),"Exception")
    
    try:
    	print "LibraryItemUsedBySave: " + Application.DocumentMetadata.LibraryItemUsedBySave.Title
    except Exception,err:
    	print(err.ToString(),"Exception")
    
    try:
    	print "LibraryPathUsedBySave: " + Application.DocumentMetadata.LibraryItemUsedBySave.Path
    except Exception,err:
    	print(err.ToString(),"Exception")
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...