Jump to content
  • How to get the Library/File path of a dxp in Spotfire® using IronPython


    In certain cases the name of the dxp might be required to pass to any other system or retrieve it for logging purposes.This python script would be handy in such cases.The sample script provides the code to get the name of the currently loaded *.dxp or a library file along with the path its saved in.

    Introduction

    In certain cases the name of the dxp might be required to pass to any other system or retrieve it for logging purposes.This python script would be handy in such cases.The sample script provides the code to get the name of the currently loaded *.dxp or a library file along with the path its saved in.

    Code sample

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    # Get the name and Path of the .dxp file
    
    from Spotfire.Dxp.Application import DocumentMetadata
    dmd = Application.DocumentMetadata #Get MetaData
    
    path = str(dmd.FileNameUsedBySave)
    # To retrieve the name of the file
    ReportName = path.rfind("") + 1  
    length = len(path) 
    analysis = path[ReportName:length]
    
    print path
    print analysis
    
    
    #Get the name and Path of the library file
    
    path = str(dmd.LoadedFromLibraryPath) 
    # To retrieve the name of the file
    ReportName= path.rfind("/") + 1 
    length = len(path)
    analysis = path[ReportName:length]
    
    print path
    print analysis
     

     

    References

    License:  TIBCO BSD-Style License

    Back to IronPython Scripting in Spotfire Examples


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...