Book a Demo

Author Topic: Objects with unique attributes  (Read 17958 times)

minna

  • EA User
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Objects with unique attributes
« on: September 04, 2014, 11:16:31 pm »
Hi,

I have create classes with attributes that I want to create objects from (with different attributes) that I can use in different diagrams / models.



For example, in 'Diagram1' I want to create 'Helicopter1' (object of 'Aircraft') with ID BYR659, colour green, type Helicopter and wing span 15.8m. In 'Diagram2' I want to create 'Plane1' with different attributes.

How can I do this? I can only change the initial attribute values of the objects, and when I do all the attributes in 'Aircraft', 'Helicopter1' and 'Plane1' and changes.....

Thank you,
Minna

minna

  • EA User
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Re: Objects with unique attributes
« Reply #1 on: September 04, 2014, 11:33:06 pm »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Objects with unique attributes
« Reply #2 on: September 05, 2014, 12:45:40 am »
I guess you're after the Set Runstate which you get in the context menu of objects.

q.

AndyJ

  • EA User
  • **
  • Posts: 337
  • Karma: +5/-3
  • It's only a model
    • View Profile
Re: Objects with unique attributes
« Reply #3 on: September 05, 2014, 01:34:39 pm »
In case that was a bit too abstract...

1. Find your class in the project browser.
2. Drag your class on to a new diagram - choose to create an "instance" of this class.
3. Right-click on the class and choose "Features and Properties" then "Set Run State"
4. For each attribute, (this is named "variable" in the dialog) you can choose to set an Operator, Value and Note.

 :)
Sun Tzu: "If you sit by the river long enough, eventually the body of MS Visio floats past."

minna

  • EA User
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Re: Objects with unique attributes
« Reply #4 on: September 05, 2014, 04:50:25 pm »
Thanks AndyJ!

I found 'Set Run State' under 'Advanced' though :)

When I create an attribute, the only available types are boolean, byte, char, double, float, int, long, short, <none>, Select Type.

1. How can I create a string attribute?
2. How can I create an attribute that is a list to choose from? Ex Colour should have values 'Red', 'Blue', 'Green' and 'Yellow'.

Thanks!
Minna

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Objects with unique attributes
« Reply #5 on: September 05, 2014, 05:19:02 pm »
You can type anything you want in the Type property. In case of your color you should create a an Enumeration element with the colors and classify the attribute with that. Anyhow, the Set Runstate will only allow to enter free text as 2nd operator.

q.

minna

  • EA User
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Re: Objects with unique attributes
« Reply #6 on: September 05, 2014, 06:17:03 pm »
Hi,

Thanks for the info!

So there is no way to get a drop down list to select from in set run state? Or a way to ensure you are entering a number (for an int attribute)?

Thanks,
Minna

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Objects with unique attributes
« Reply #7 on: September 05, 2014, 07:35:05 pm »
No, there isn't. Except you were willing to write you own dialog with an add-in.

q.
« Last Edit: September 05, 2014, 07:35:50 pm by qwerty »

minna

  • EA User
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Re: Objects with unique attributes
« Reply #8 on: September 08, 2014, 04:53:00 pm »
Hi,

Thanks for the feedback. So I cannot create an enumeration (dropdown list) to select an attribute in a run state object.

The idea is to have an Aircraft with all the attributes (empty). I then want to create a Helicopter in one diagram with certain attributes and an air-plane in another diagram with other attributes. But I would like to pick those attributes from a list (if an attribute is set up as an enum).

Is there any way I can do it in EA? I looked at using classes and objects for my solution. Is there maybe something different I can use to solve my initial post problem?

Thanks,
Minna


KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Objects with unique attributes
« Reply #9 on: September 08, 2014, 04:55:36 pm »
You can use tagged values instead of run state variables. It's fairly easy to define a tagged value type as an enumeration and then you can select a value from a list box.
« Last Edit: September 08, 2014, 04:55:50 pm by KP »
The Sparx Team
[email protected]

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Objects with unique attributes
« Reply #10 on: September 08, 2014, 07:34:03 pm »
What KP says is certainly an alternative. But in that case you'd need to turn on Features/Visibility/Tags for each object with those tags.

q.

minna

  • EA User
  • **
  • Posts: 64
  • Karma: +1/-0
    • View Profile
Re: Objects with unique attributes
« Reply #11 on: September 08, 2014, 08:34:55 pm »
Hi,

Using tagged values should resolve my problem.

Thanks to all!
Minna