Labels

Create a document property and set its value

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from Spotfire.Dxp.Data import DataProperty 
from Spotfire.Dxp.Data import DataType 
from Spotfire.Dxp.Data import DataPropertyClass 

propName  = "myDocumentProperty2" 
attr   = DataProperty.DefaultAttributes 
prop   = DataProperty.CreateCustomPrototype(propName, DataType.String, attr) 

Document.Data.Properties.AddProperty(DataPropertyClass.Document, prop) 

prop.Value  = "myDocumentPropertyValue"

10 comments:

  1. is there a way to do this where it first checks if the doc property exists? Something like

    if myDocumentProperty2 exists do nothing, else ....

    ReplyDelete
    Replies
    1. Got it from another forum. Here's the code if anyone needs. If the doc property already exists it just fills it with 'hello' otherwise it will create and fill the doc property

      ----------------------------------------

      from Spotfire.Dxp.Data import DataProperty
      from Spotfire.Dxp.Data import DataType
      from Spotfire.Dxp.Data import DataPropertyClass

      if Document.Data.Properties.ContainsProperty (DataPropertyClass.Document,myProp1):
      Document.Properties[myProp1] = 'hello'
      else:
      propName=myProp1
      attr=DataProperty.DefaultAttributes
      prop=DataProperty.CreateCustomPrototype(propName, DataType.String, attr)
      Document.Data.Properties.AddProperty(DataPropertyClass.Document, prop)
      prop.Value=myProp1Val

      Delete
  2. I have to voice my passion for your kindness giving support to those people that should have guidance on this important matter.
    ---------------------------------
    property in Italy for sale

    ReplyDelete

  3. I enjoyed over read your blog post. Your blog have nice information,
    I got good ideas from this amazing blog.
    goldenslot
    gclub
    gclub casino

    ReplyDelete
  4. Hey there! This is a great blog, I really enjoy reading this post.

    Looking for the lowest price to start company? check out the best singapore company incorporation firm today!

    ReplyDelete
  5. What use would this script be for?

    ReplyDelete
  6. I enjoyed over read your blog post. Your blog have nice information. chrisbuyshomessandiego.com

    ReplyDelete
  7. very interesting blog, thank you for sharing. Realty Davao

    ReplyDelete
  8. Are you looking up for the best Real estate script mall in Chennai? As a Digital marketer and a graduate in computer science after many analysis, my choice would be Real estate script mall

    ReplyDelete