Jump to content
  • How to add a new Document Property in Spotfire® using IronPython


    This article provides code sample to add a new document property in the Spotfire dashboard.

    Introduction

    This article provides code sample to add a new document property in the Spotfire dashboard.

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Data import DataPropertyClass,DataProperty,DataType 
     
    dpName  = "newDocumentProperty1"
    
    # Default attributes are - IsPersistent, IsVisible, IsEditable
    
    # Signature of CreateCustomPrototype(string propertyName,string description,Object defaultValue,DataType dataType,DataPropertyAttributes attributes)
    
    property   = DataProperty.CreateCustomPrototype(dpName,"This is my property","hello", DataType.String, DataProperty.DefaultAttributes) 
    
    Document.Data.Properties.AddProperty(DataPropertyClass.Document, property) 
    
    #To change the value of the document property
    property.Value  = "Hello Spotfire"
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...