Author Topic: Shape script: Show tagged value at bottom left  (Read 187 times)

Kristofer

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Shape script: Show tagged value at bottom left
« on: December 05, 2017, 09:16:11 pm »
Hi!

We have an element type with several tagged values. Some of them are relevant to one group of people, and others are relevant to another group. Unfortunately we cannot select which tagged values should be visible in a certain diagram.

So to solve atleast some of the problem, I would like to create a shape script that always shows the tags that are relevant for all people, and if someone creating a diagram want to show all tagged values, that is up to them.

I thought that one option is to use "shape label" with SetOrigin = SW.

Code: [Select]
shape label {
   SetOrigin("SW", 5, 35);
   Println("#TAG:Alias#");
   Print("#TAG:ID#");
}

This makes it possible to hide these tagged values if someone wants to show all tagged values (instead of having duplicate information). The problem is however that the default width of the label is too short so the user needs to immediately change the width. The maximum width of the label may also be too short, which makes the text wrap.

Is there another (better) way to do this?

The requirement is essentially:
  • Show the value of certain tagged values, somewhere inside the element, each on its own line.
  • Don't wrap the text
  • Preferable (but not a requirement), hide this if all tagged values are shown on the element

qwerty

  • EA Guru
  • *****
  • Posts: 8972
  • Karma: +136/-124
  • I'm no guru at all
    • View Profile
Re: Shape script: Show tagged value at bottom left
« Reply #1 on: December 05, 2017, 09:57:55 pm »
Just (without too much thinking): how about stereotyping diagrams and having the shape script select which TVs to show on which?

q.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1073
  • Karma: +81/-5
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Shape script: Show tagged value at bottom left
« Reply #2 on: December 05, 2017, 10:54:46 pm »
Is there another (better) way to do this?

In brief: don't.

Do not allow a metamodel where one element type represents different aspects of some concept. You will end up tearing your hair out.
I know you won't listen to that -- no one ever does -- but just for the record.

I'm with qwerty on this one, it's better to use some property of the diagram, rather than the element, to determine which tagged values you show. I'd suggest the .Type or .MdgType rather than the .Stereotype because the diagram stereotype can only be set manually and is not really a true property of the diagram, but it depends on how you set up your diagrams.

If you hadn't bunched all the unrelated tags into the same element, you could have used custom compartments with ChildElement or RelatedElement sub-scripts.


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

Kristofer

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: Shape script: Show tagged value at bottom left
« Reply #3 on: December 05, 2017, 11:51:34 pm »
This is the situation:

We have information flow diagrams showing our applications. We have added tagged values for ID, alias, lifecycle, status and other things related to the application. Everyone needs to see the ID and alias so we know that we are all talking about the same application (different parts of the organisation seems to use different names). The other tags are mostly targeting the more advanced group and is not of interest to the "general public"; hence I would like to hide them in some diagrams. Using tags is also a convenient way to make things searchable (i.e. show me all applications that are under development).

Right now I am trying to find out the best way to do this. We can still change the way we work. Is custom compartments a better way?

I could use the diagram stereotype to show different tagged values. This shape script will go into a mdg profile later, so it may be better to use Type or MdgType.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1073
  • Karma: +81/-5
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Shape script: Show tagged value at bottom left
« Reply #4 on: December 06, 2017, 12:56:47 am »
I could use the diagram stereotype to show different tagged values. This shape script will go into a mdg profile later, so it may be better to use Type or MdgType.

If you use Type or MdgType, you can create custom diagram types which are preconfigured to show/hide relevant sets of tags. Downside with that is you have to change diagram type in order to change what's shown in it. If instead you use the diagram stereotype, you can change it on the fly, but you can't create a custom diagram type that only shows a specific subset of tags. So that's a question of how you prefer to work.

Either way though, changing diagram type or stereotype constitutes a modification of the diagram which may require you to unlock it etc.

Quote
Right now I am trying to find out the best way to do this. We can still change the way we work. Is custom compartments a better way?

With this approach, you move the different specialized sets of tags to different elements (either child elements or other elements connected to the core element), then select custom compartments in each diagram. You can also create linked notes which show custom compartments. Custom compartments are a bit wonky at least in version 11, and IIRC you have to select custom compartments individually for each element. So it's all down to how you want to work.


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

Kristofer

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Re: Shape script: Show tagged value at bottom left
« Reply #5 on: December 08, 2017, 09:12:50 pm »
Thanks for the options!

The Custom Compartment with RelatedElement is also interesting.