some examples of scripts

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

some examples of scripts

Postby » Tue Feb 12, 2019 5:24 pm

I want to write a script that will let me move some requirements from one directory and sort them into a series of final locations based upon a field in the requirements what i want to do is select a base package

1. Find all the requirements in the package
2. sort them by the section field I added with a custom profile to my requirements
3. Now move the requirements from the current location to a folder that is named starting with the section number ie "1.3.4 this is a folder" will get every requirement that has a section field of 1.3.4.

I can find only one small example of writing scripts, and looking at the Java API is about as clear as mud to me given I can't find much in the way of examples. I have no problems doing a lot of this stuff in my custom report templates, but that does not work for scripts.

Would anyone have any examples of how to do things like

1. Grab the ownedElement list from the initial package, what is the type i use and what is the call??
2. how do I walk through it so I can process each requirement. I am not sure how to get the list of owned elements and how they can be accessed in a list.

Some examples that i can sort though would be nice. there appears to only be one example in multiple languages in the samples area of the install, and the api reference examples don't seem to be working at that level.

Thanks, jim
Forum Beginner
Forum Beginner
Posts: 25
Posts Rating:1
Joined: Thu Apr 13, 2017 11:02 am

Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests