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

Can I add Metadata via Python API?

Community Beginner ,
Aug 08, 2023 Aug 08, 2023

Copy link to clipboard

Copied

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

Views

154

Translate

Translate

Report

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.png

Reuben5C64_1-1691524205661.png

 

 

Votes

Translate

Translate
Explorer ,
Aug 08, 2023 Aug 08, 2023

Copy link to clipboard

Copied

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.png

Reuben5C64_1-1691524205661.png

 

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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