Book a Demo

Author Topic: Tagged value <memo> broken  (Read 7087 times)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Tagged value <memo> broken
« on: May 12, 2020, 01:34:54 am »
Once you enter <memo> in the description of a TV you can only add/edit text via the ellipsis. When you refer to that TV in a shape script like

Code: [Select]
print("#TAG:myMemoTag#")

it will just render "<memo>" in the picture, not the valuable part. I'd guess this is settled and there's no way around it (execept add-in which are blocked here for admin reasons). Talking about 13.5.

q.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Tagged value <memo> broken
« Reply #1 on: May 12, 2020, 08:25:26 am »
This command in a shape script

Code: [Select]
print("#TAG:myMemoTag#")

could end up displaying 60,000 characters of text, and shape scripts don't have any text manipulation functionality for a user to mitigate against that. I think we considered displaying the first <n> characters of text followed by ellipses, but decided it would be better to display "<memo>" indicating that there is text elsewhere, go look for it.

Thinking out loud (i.e. don't try this it won't work), but maybe something like this would help, putting the <n> value under user control?
Code: [Select]
print("#TAG:myMemoTag,50#"); // display 50 characters max
« Last Edit: May 12, 2020, 08:46:42 am by KP »
The Sparx Team
[email protected]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Tagged value <memo> broken
« Reply #2 on: May 12, 2020, 10:34:47 am »
This command in a shape script

Code: [Select]
print("#TAG:myMemoTag#")

could end up displaying 60,000 characters of text, and shape scripts don't have any text manipulation functionality for a user to mitigate against that. I think we considered displaying the first <n> characters of text followed by ellipses, but decided it would be better to display "<memo>" indicating that there is text elsewhere, go look for it.

Thinking out loud (i.e. don't try this it won't work), but maybe something like this would help, putting the <n> value under user control?
Code: [Select]
print("#TAG:myMemoTag,50#"); // display 50 characters max
With the trailing ellipsis, that could work.  The training ellipsis would then also be used when we truncate a note using the [Ctrl+Shift+Y] Compartment Visibility dialog functionality.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Tagged value <memo> broken
« Reply #3 on: May 12, 2020, 05:28:04 pm »
Thinking out loud (i.e. don't try this it won't work), but maybe something like this would help, putting the <n> value under user control?
Code: [Select]
print("#TAG:myMemoTag,50#"); // display 50 characters max

Make it a separate parameter. For the love of God. Comma is a permitted character in tagged value names, as are digits.

So change it to   print("#TAG:myMemoTag#",50);   and we'll say no more about it.

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

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Tagged value <memo> broken
« Reply #4 on: May 12, 2020, 05:46:12 pm »
Thinking out loud (i.e. don't try this it won't work), but maybe something like this would help, putting the <n> value under user control?
Code: [Select]
print("#TAG:myMemoTag,50#"); // display 50 characters max

Make it a separate parameter. For the love of God. Comma is a permitted character in tagged value names, as are digits.

So change it to   print("#TAG:myMemoTag#",50);   and we'll say no more about it.

/U
Good catch, Uffe!   Missed that!  I read a separate parameter.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Tagged value <memo> broken
« Reply #5 on: May 12, 2020, 05:53:53 pm »
As suggested a 2nd parameter would be convenient (say the default would be 50 and could be replaced by specifying it).

As we are at it: in the Link to Element Feature EA shows that <memo> as to no use. The text is displayed but above you have that additional superfluous <memo>. That should simply be removed. We had moved things from UC requirements to dedicated tagged values. Now the text in the notes has this additional <memo> that hurts my eye.

q.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Tagged value <memo> broken
« Reply #6 on: May 13, 2020, 08:48:25 am »
Thinking out loud (i.e. don't try this it won't work), but maybe something like this would help, putting the <n> value under user control?
Code: [Select]
print("#TAG:myMemoTag,50#"); // display 50 characters max

Make it a separate parameter. For the love of God. Comma is a permitted character in tagged value names, as are digits.

So change it to   print("#TAG:myMemoTag#",50);   and we'll say no more about it.

/U


1. Are you sure comma is permitted in tag names? At best I would say it's inadvisable.
2. Your suggestion would modify the output of the print command, mine would modify the output of the macro substitution. Different things.
The Sparx Team
[email protected]

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Tagged value <memo> broken
« Reply #7 on: May 13, 2020, 09:37:32 am »
Comma in stereotypes is even more funny. Or how is it called when it hurts in the rear?

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Tagged value <memo> broken
« Reply #8 on: May 13, 2020, 11:24:05 am »
One point on permitted characters in tagged value names.

When represented in XMI, tagged value names correspond to and an XML attribute name. Given that is the official interchange format, it's my opinion that valid names are implicitly restricted to valid XML names. At a minimum it would be a recommendation.

Code: [Select]
  [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
  [5] Name ::= (Letter | '_' | ':') (NameChar)*

Given ':' denotes the namespace, that means you should only use alphanumeric, '.', '-' and '_'. Stereotype names would have the same recommendation.

I would suggest that even if you were worried about having a comma in a tagged value name, having it inside the substitution is a more practical solution. Even if the code checks for the full tag name if it doesn't find the one with the comma.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Tagged value <memo> broken
« Reply #9 on: May 13, 2020, 05:01:06 pm »
XML doesn't enter into it.
  • Configure -- UML Types -- Tagged Value Types
  • New
  • Tag Name: "bla,50" -- Description: "Weird tag" -- Detail: "Type=Enum; Values=a,b,c;"
I'm not saying it's impossible to make KP's suggestion work. I'm saying separating the parameters is the better design.
My theories are always correct, just apply them to the right reality.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Tagged value <memo> broken
« Reply #10 on: May 13, 2020, 05:18:38 pm »
We're not saying that it's impossible to add a tagged value with a comma in the name in EA. I will say that it's inadvisable at best and stupid at worst. My comment about XML was that it is illegal in the only defined standard representation for a model. It's already impossible for a shape script to print the content of a tag that contains a '#'.

Adding a parameter to the print function doesn't help.

Maybe it does for your example, but not in general. The bits between the # characters define the substitution. It doesn't make sense to then alter that substitution based

Code: [Select]
print("#TAG:memo1# and #TAG:memo2#",50);

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Tagged value <memo> broken
« Reply #11 on: May 13, 2020, 06:24:10 pm »
Code: [Select]
print("#TAG:memo1# and #TAG:memo2#",50);
I hadn't considered the multiple-substitutions-in-same-string case. But I still think the separate parameter is better.

With the separate parameter, nothing's stopping you from
Code: [Select]
print("#TAG:memo1#",50);
print(" and ");
print("#TAG:memo2#",50);
if that's what you want.

Ultimately, it comes down to semantics. Do you want a function "substitute this tag name for at most 50 characters of its value", or do you want a function "print at most 50 characters out of the value of this tag"?

I prefer the latter. It makes sense to control the amount of text that gets printed, it makes less sense to control the amount of text that gets substituted. To me.

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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Tagged value <memo> broken
« Reply #12 on: May 13, 2020, 09:29:51 pm »
@Uffe: this is Sparxian thinking. I gave up on that.

q.