Skip to main content
Participant
August 8, 2023
Answered

Can I add Metadata via Python API?

  • August 8, 2023
  • 1 reply
  • 395 views

Hello! 

I want to save some information I create via python to a new metadata property. Is this possible? 

I can see it's possible using pysbs, but I assume that's for when I don't have designer open already, can I use pysbs functions inside designer? 

 

Thanks!

This topic has been closed for replies.
Correct answer Reuben5C64

if you have a package object, you can do something like this:

metadata = package.getMetadataDict()
metadata.setPropertyValueFromId("key", SDValueString.sNew("value"))

 I don't see the sd api reference online, but from Designer if you click "Help"->"Scripting Documentation", you should be able to find what you're looking for in the API to create and retrieve metadata

 

 

1 reply

Reuben5C64Correct answer
Inspiring
August 8, 2023

if you have a package object, you can do something like this:

metadata = package.getMetadataDict()
metadata.setPropertyValueFromId("key", SDValueString.sNew("value"))

 I don't see the sd api reference online, but from Designer if you click "Help"->"Scripting Documentation", you should be able to find what you're looking for in the API to create and retrieve metadata

 

 

mo42Author
Participant
August 17, 2023

Amazing, this is exactly what I was hoping for, thank you so much! 
I had assumed the key needed to exist before I could use setPropertyValueFromId, but you don't! 

Thanks again! 🙂