Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can I add Metadata via Python API?

Community Beginner ,
Aug 08, 2023 Aug 08, 2023

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!

TOPICS
Scripting
254
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Aug 08, 2023 Aug 08, 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

Reuben5C64_0-1691524150047.pngexpand image

Reuben5C64_1-1691524205661.pngexpand image

 

 

Translate
Explorer ,
Aug 08, 2023 Aug 08, 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

Reuben5C64_0-1691524150047.pngexpand image

Reuben5C64_1-1691524205661.pngexpand image

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 17, 2023 Aug 17, 2023
LATEST

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! 🙂 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines