Creating a Derived Property in a Table

Diagramming issues

Moderator: Moderators

Creating a Derived Property in a Table

Postby somethingMBSE » Tue Jun 29, 2021 5:25 pm

I need to create a column, lets say named "Answer", in a requirement table that just says "yes" if the string "XYZ" is in the requirement text. I would normally just create the property "Answer" in the requirement's stereotype, but I don't have access to the profile that stereotype is in, and I don't want to create a separate stereotype with just that attribute and apply it to every requirement. So I tried just creating a derived property with a "find" operation to search "*XYZ*" with context "THIS" in the requirement's text. I just don't know how to now set the output of that operation to give the requirements' new derived property "Answer" a value of "yes".

I hope that makes sense.

Thank you,
somethingMBSE
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:3
Joined: Tue Jun 29, 2021 5:15 pm

Re: Creating a Derived Property in a Table

Postby ogirdor » Thu Jul 01, 2021 12:57 am

Hi,

I generally prefer to use custom columns instead of derived properties if I will need the value only in the table (I suppose this is less computing intensive than having it calculated every time you use your element anywhere in the model).

For your situation one option would be to use a property test like this:

2021-07-01 08_41_10-MagicDraw 19.0 - ReqTxtTable_PropertyTest.png


As you can see, in this example we are looking for requirements containing the word "memory". The property test will return a boolean value, by setting the return type to Boolean we get in the Custom Column the true/false check boxes.

If you want to have a custom text. then I guess you can use this result as input to a script. But honestly I did not find an easy way to evaluate the result of the PropertyTest as a boolean... Or you use only a script to retrieve the requirement test, search for your string, and output "yes"/"no".

Best regards
You do not have the required permissions to view the files attached to this post.
ogirdor
Forum Beginner
Forum Beginner
 
Posts: 61
Posts Rating:18
Joined: Wed Jun 03, 2020 4:41 am

Re: Creating a Derived Property in a Table

Postby somethingMBSE » Thu Jul 01, 2021 12:08 pm

@ogirdor,

That's perfect! I didn't know the distinction between "New Derived Property" and "Custom Column" at the time, but I got a script to work in a custom column.

Screenshot 2021-07-01 131627.jpg


Thank you for your alternative.




ogirdor wrote:Hi,

I generally prefer to use custom columns instead of derived properties if I will need the value only in the table (I suppose this is less computing intensive than having it calculated every time you use your element anywhere in the model).

For your situation one option would be to use a property test like this:

2021-07-01 08_41_10-MagicDraw 19.0 - ReqTxtTable_PropertyTest.png


As you can see, in this example we are looking for requirements containing the word "memory". The property test will return a boolean value, by setting the return type to Boolean we get in the Custom Column the true/false check boxes.

If you want to have a custom text. then I guess you can use this result as input to a script. But honestly I did not find an easy way to evaluate the result of the PropertyTest as a boolean... Or you use only a script to retrieve the requirement test, search for your string, and output "yes"/"no".

Best regards
You do not have the required permissions to view the files attached to this post.
somethingMBSE
Forum Newbie
Forum Newbie
 
Posts: 7
Posts Rating:3
Joined: Tue Jun 29, 2021 5:15 pm


Return to Diagramming

Who is online

Users browsing this forum: No registered users and 1 guest