Jump to content
  • How to create and set a new Document Property in Spotfire® using IronPython Script


    How to create and set a new Document Property in Spotfire.

    Introduction

    How to create and set a new Document Property in Spotfire.

    Code Sample

     # Copyright © 2019. TIBCO Software Inc. Licensed under TIBCO BSD-style license.  
       
       from Spotfire.Dxp.Data import DataProperty  
       from Spotfire.Dxp.Data import DataType  
       from Spotfire.Dxp.Data import DataPropertyClass   
       
       myPropertyName  = "myNewDocumentProperty"  
       myAttributes   = DataProperty.DefaultAttributes  
       myProperty   = DataProperty.CreateCustomPrototype(myPropertyName, DataType.String, myAttributes)   
       
     #Create the Property, catch if it fails/exists. 
       try:
    	Document.Data.Properties.AddProperty(DataPropertyClass.Document, myProperty)  
       except:
    	print("Property creation failed. Does it already exists?")  
                  
     #Set the Property 
       Document.Properties[myPropertyName]  = "myDocumentPropertyValue"
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...