How to save a runtime value to defaut of a value property

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

How to save a runtime value to defaut of a value property

Postby xiaolian.warner@ngc.com » Wed May 12, 2021 12:04 pm

Hello There,

I have been seaching here, had not found a thread to help me to save a runtime value to the default of a value propery. Any help would be greatly appreciated.
Thank you
Lian
xiaolian.warner@ngc.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Thu Dec 17, 2020 8:49 am

Re: How to save a runtime value to defaut of a value property

Postby saulius_p » Wed May 12, 2021 1:23 pm

Hello Lian,

Good to talk to you. Do you need this as automatic action at the end of the simulation? I do not think it is available without scripting.
Alternative ways:
1. You can save runtime value manually from right click menu in simulation dialog > Variables panel.
2. Another way to save runtime values at the end of the simulation is to store them into existing or new instance. In such case you need to create simulation config and set instance or package as Result property value for simulation config.

Let me know if more details are needed.

Kind regards,
Saulius
Best regards,
Saulius Pavalkis
User avatar
saulius_p
No Magic
No Magic
 
Posts: 289
Posts Rating:11
Joined: Fri Dec 04, 2009 5:37 am
Full name: Saulius Pavalkis

Re: How to save a runtime value to defaut of a value property

Postby xiaolian.warner@ngc.com » Wed May 12, 2021 6:46 pm

Thank you for the quick response. Yes, the two ways you listed there. I have used them. I do need to find a way to automatically save the values instead of involving right click, click etc... Any references of scripting you can point me to?
Thank you!
xiaolian.warner@ngc.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Thu Dec 17, 2020 8:49 am

Re: How to save a runtime value to defaut of a value property

Postby saulius_p » Mon May 17, 2021 3:16 pm

Hello Lian,

Please find quick sample attached.

Kind regards,
Saulius
You do not have the required permissions to view the files attached to this post.
Best regards,
Saulius Pavalkis
User avatar
saulius_p
No Magic
No Magic
 
Posts: 289
Posts Rating:11
Joined: Fri Dec 04, 2009 5:37 am
Full name: Saulius Pavalkis

Re: How to save a runtime value to defaut of a value property

Postby xiaolian.warner@ngc.com » Tue May 18, 2021 9:10 am

Thank you! It works. I tried to add another string attribute to the test block, it works individually either the real or string attribute, but not both at the same time. Will you thing you can modify the script to work for both?

Much Appreciate your help!
Lian
xiaolian.warner@ngc.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Thu Dec 17, 2020 8:49 am

Re: How to save a runtime value to defaut of a value property

Postby saulius_p » Wed May 19, 2021 8:06 am

Hello LIan,

Good to hear that script is helpful. Can you attach model sample which does not work?

Sincerely,
Saulius
Best regards,
Saulius Pavalkis
User avatar
saulius_p
No Magic
No Magic
 
Posts: 289
Posts Rating:11
Joined: Fri Dec 04, 2009 5:37 am
Full name: Saulius Pavalkis

Re: How to save a runtime value to defaut of a value property

Postby holola589@gmail.com » Thu Jun 10, 2021 3:54 am

I did it that way but when I open it again the values are still empty and there seems to be no history, it's just a cell's value and no row and column continuity, What's the problem with it?
holola589@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 2
Posts Rating:0
Joined: Thu Jun 10, 2021 3:48 am


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests

cron