Author Topic: Classifier's tag values being overridden by shapescript default  (Read 278 times)

SparxUser19

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Hello,

I am working with an MDG element that contains a shapescript to set the fill color depending on a custom tag's value. When I drag and drop the element from the Project Browser as an instance, the tag values are resetting as per the shapescript, instead of bringing over the value set on the classifier element. Is there a way to prevent this?
I am hoping not to use script to update these values.

Thanks!

qwerty

  • EA Guru
  • *****
  • Posts: 11186
  • Karma: +267/-247
  • I'm no guru at all
    • View Profile
Re: Classifier's tag values being overridden by shapescript default
« Reply #1 on: July 28, 2020, 03:47:10 am »
Depends on your definition. Does your stereotype extend the instance (probably Object) as well? If not, the stereotype/shape will not apply.

q.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1664
  • Karma: +112/-11
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Classifier's tag values being overridden by shapescript default
« Reply #2 on: July 28, 2020, 03:41:12 pm »
Hello,

... the tag values are resetting as per the shapescript, instead of bringing over the value set on the classifier element.

Creating an instance of a classifier with tagged values doesn't add any tagged values to the instance.
EA shows the classifier's tagged values in the properties of the instance, but tags are only created in the instance when you edit their values.


/Uffe
My theories are always correct, just apply them to the right reality.

SparxUser19

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Classifier's tag values being overridden by shapescript default
« Reply #3 on: July 29, 2020, 03:26:39 am »
Thank you for your responses,Qwerty and Uffe. Follow up questions..

Qwerty - Not sure how I can get the stereotype to extend the instance. In the MDG, the stereotype does extend the base object class. In that stereotype ,I have defined the custom attributes and the associated shapescript.

Uffe - I am unsure about what you mean. The classifier:instance combination is in MDG, and then when I import the MDG, I have elements with my custom stereotype and they show the related custom tag attributes. When I try to drop this element as an instance, the shapescript takes over. The tag values are created as if it is creating a new MDG defined element. I hope I have provided some more information instead of reiterating what you already gathered :) Not sure if you meant the instance that I create in MDG, or when I am using the element.

Thanks again!
SparxUser19

Uffe

  • EA Practitioner
  • ***
  • Posts: 1664
  • Karma: +112/-11
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Classifier's tag values being overridden by shapescript default
« Reply #4 on: July 29, 2020, 04:46:31 am »
Hi again,


I mean that, stereotypes and profiles aside, while it may look like tagged values are inherited from a classifier to its instances, they aren't. The classifier's tagged values are presented in the instance's properties dialog, but no tagged values are added to the instance unless and until you edit their value. So if you are expecting EA to auto-create a set of tagged values in an instance because they are defined in the classifier, that won't happen.

If you have defined stereotypes both for the classifier and the instance, you can specify that the instance shall have the same (or indeed a different) set of tagged values as the classifier. You can also specify default values for the tags.
But you can't specify that the value of a tagged value in an instance shall be copied from the classifier, so if you've changed the value of a tagged value in a classifier (from the default), and create an instance from it, that value will not be copied to the new instance: the instance will have the default value. (You can of course set different defaults in the classifier and instance stereotypes, but that still won't copy the actual tagged value from the classifier to the instance.)


/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 11186
  • Karma: +267/-247
  • I'm no guru at all
    • View Profile
Re: Classifier's tag values being overridden by shapescript default
« Reply #5 on: July 29, 2020, 07:48:26 am »
Just also have an Object metaclass and make your stereotype extend that as well. There also a meta-attributes _instanceMode and _instanceType. Just see the help about their meaning.

q.

SparxUser19

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Classifier's tag values being overridden by shapescript default
« Reply #6 on: August 01, 2020, 12:52:57 pm »
Thank you Uffe and qwerty for following up. The explanations were helpful.

I doubt the shapescript would let me accommodate this, will keep looking. Thanks for your time.