Author Topic: Error in Attribute.Update() if Stereotype >50  (Read 8959 times)

Pavel Bunygin

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Error in Attribute.Update() if Stereotype >50
« on: September 20, 2013, 03:38:10 am »
Hello!
I’m working on VBA script for updating attributes. I’m receiving
an error in EA.Attribute.Update() function when EA.Attribute.Stereotype has more than 50 characters.

I’m receiving the "Multiple-step operation generated errors. Check each status value." error each time when I’m trying set  stereotype more than 50 characters.  But there is no any problem when I do it in user interface.
Could you please give any help to avoid this error?
Please find an example below.

Code: [Select]
Dim myAttribute As EA.Attribute
Set myAttribute = getAttributeByGUID(parentClass, GUID)
    'set properties
    myAttribute.name = name
    myAttribute.stereotype =  myAttribute.stereotype  'stereotype
    myAttribute.StereotypeEx = myAttribute.StereotypeEx 'stereotype
    myAttribute.Notes = description
    myAttribute.Type = attrType
    'save attribute
    myAttribute.Update

Thanks
« Last Edit: September 20, 2013, 04:06:07 am by PavelBunygin »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Error in Attribute.Update() if Stereotype
« Reply #1 on: September 20, 2013, 04:45:54 am »
The UI simply swallows the error and cuts the stereotype after 50 chars. The underlying column fits only 50 chars. So you're lost if you try to fill in more than that.

Definitely a bug. But likely superfluous to report.

q.
« Last Edit: September 20, 2013, 04:46:43 am by qwerty »

Pavel Bunygin

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Error in Attribute.Update() if Stereotype >50
« Reply #2 on: September 20, 2013, 07:27:03 pm »
No, I've checked that. In case Stereotype >50 there is null in  Attribute.stereotype but a full value in Attribute.StereotypeEx.

Also I've checked database and there is null in t_attribute.stereotype  but EA gets the full value from t_stereotypes or from t_xref tables.

In my code above I'm trying to put the same values that are already stored an receive the error. But there is no error when Stereotype <50
Code: [Select]
  myAttribute.stereotype =  myAttribute.stereotype  'stereotype
   myAttribute.StereotypeEx = myAttribute.StereotypeEx 'stereotype

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13378
  • Karma: +563/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Error in Attribute.Update() if Stereotype >50
« Reply #3 on: September 20, 2013, 07:30:59 pm »
You better report it as a bug then.

In the meantime you can work around it by inserting/updating the database directly, but that is not for the faint-hearted.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Error in Attribute.Update() if Stereotype >50
« Reply #4 on: September 20, 2013, 08:45:50 pm »
Pavel,
no idea what you tested, but I simply typed a stereotype 012345679012345679012345679012345679012345679012345679 (60 chars) and EA silently cut it to 012345679012345679012345679012345679012345679 (50 chars). I did not look into the underlying db definition, but that result is rather clear.

q.

Pavel Bunygin

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Error in Attribute.Update() if Stereotype >50
« Reply #5 on: September 23, 2013, 06:01:19 pm »
Interesting.
I did the same with your numbers. But there is no cutting and it is working as I said before.
I'm using the 10.0.1006 version of EA.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Error in Attribute.Update() if Stereotype >50
« Reply #6 on: September 24, 2013, 07:12:36 am »
It might be related to the RDBMS. I simply used EAP.

q.

Stefan Bolleininger

  • EA User
  • **
  • Posts: 308
  • Karma: +0/-0
    • View Profile
Re: Error in Attribute.Update() if Stereotype >50
« Reply #7 on: September 25, 2013, 04:27:27 pm »
Hi,

very curious, looking into the sql db:

t_attribute: Stereotype =        varchar(50)
t_stereotype Stereotype =        varchar(255)

Regards

Stefan
Enterprise Architect in "safetycritical development" like medical device industry. My free Add-in at my Website

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Error in Attribute.Update() if Stereotype
« Reply #8 on: September 25, 2013, 08:16:45 pm »
However, if you try to define a stereotype with Settings/UML it is always silently cut down to 50 chars (with EAP; I currently have no server available). So its futile to wonder where the rest is gone.

The schema offers a variety of 50/255 length combinations for stereotypes. I'd always go for the least (which is 50). It is inconsequent and typical EAUI. But that's how it is. Send in a bug report and wait a couple of years. It might be corrected then.

q.
« Last Edit: September 25, 2013, 08:22:12 pm by qwerty »

Pavel Bunygin

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Error in Attribute.Update() if Stereotype
« Reply #9 on: September 27, 2013, 03:28:59 am »
Quote
However, if you try to define a stereotype with Settings/UML it is always silently cut down to 50 chars (with EAP; I currently have no server available).

I can't see it in EAP too... Diagrams and project browser show full stereotype. I think that they get full value from t_xref or t_stereotypes because I can find them here.


Pavel

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Error in Attribute.Update() if Stereotype >50
« Reply #10 on: September 27, 2013, 07:38:59 am »
Can you tell us which RDBMS you use?

q.

Pavel Bunygin

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Error in Attribute.Update() if Stereotype >50
« Reply #11 on: September 27, 2013, 05:29:26 pm »
Quote
Can you tell us which RDBMS you use?
I use MySQL5.5 and EAP file. There is no difference in EA user interface behavior. The screen that I posted was created in EAP.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Error in Attribute.Update() if Stereotype
« Reply #12 on: September 27, 2013, 11:48:57 pm »
I just tested again and now there is no truncation :o Have I been drunk? I'll play around a bit with your code sample and dig a bit deeper into that stereotype mystery.

q.

[edit] I have tested your example above. Trying to assign more than 50 chars results in
Quote
DAO.Field [3163]

The field is too small to accept the amount of data you attempted to add.  Try inserting or pasting less data.
with GetLastError. And yes: extending the 50 chars (allowed by automation) manually works with no problems. So my advise: report a bug! I currently have no idea how EA manages to hold more than 50 chars if the database column is restricted to 50 chars, but I'll dig a bit more into that.

[edit2] It looks like our good old friend t_xref helps out in that case. It stores the stereotype in a record like
Quote
@STEREO;Name=012345678901234567890123456789012345678901234567890;GUID={26CABE93-72D4-48c7-A81D-562599913507};@ENDSTEREO;
where the column itself is a Memo field. The Stereotype column in t_attribute is actually unused in cases where the size limit of 50 is exceeded.

If you try to paste more than 255 chars manually you get above message also in the GUI. Simply because t_stereotype can hold max. 255 chars, although t_xref could handle more.

I was just reading a thread about bad database design. There's always some icing you find on the EA cake.
« Last Edit: September 29, 2013, 05:22:45 am by qwerty »

Pavel Bunygin

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Error in Attribute.Update() if Stereotype >50
« Reply #13 on: September 30, 2013, 05:19:53 pm »
I've contacted support earlier and I've got an answer today.
Quote
We can confirm the issue described in your report and this will be investigated further by our development team.  The reference number for this issue is 13096175.
 
Unfortunately we cannot provide a schedule for this issue to be resolved as yet.  If you wish to enquire about the status of this issue again at a later time, please include the provided reference number with your enquiry.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Error in Attribute.Update() if Stereotype >50
« Reply #14 on: September 30, 2013, 08:14:07 pm »
What you could do is to create that entry in t_xref yourself. Not nice, but EA often forces us to do such ugly things.

q.