Book a Demo

Author Topic: How to use a tagged value with type memo?  (Read 6901 times)

palim

  • EA User
  • **
  • Posts: 31
  • Karma: +1/-0
    • View Profile
How to use a tagged value with type memo?
« on: March 12, 2010, 08:49:12 pm »
Hello guys,

I`ve recently added some tagged values into an EA element programmatically (VB).
This works fine, but a tagged value`s value field is limited to 256 characters. Now I`ve learned that you might be able to use a tagged value of type 'memo'.
To do this, I created a structured tag value and used the type 'memo' (in EA: Settings -> UML -> Tagged Value Type).

My problem is that I don`t how to access this tagged value programmatically.

I tried this (ain`t working):

    Dim tags As EA.Collection
    Set tags = parentClass.TaggedValues
        
    Dim newTag As EA.TaggedValue
    Set newTag = tags.AddNew(tagName, tagValue)
    
    newTag.Update
    tags.Refresh


When the function containing this code is called, VB show an error message that the saved value is to high. That means that I`m trying to store more than 256 characters into the tagged value.

I also tried this (short version:

Set newTag = tags.GetElementByName("Memo-Tag")
newTag.Value = "content"


This didn`t work either.


Does anybody know how to access a 'memo' tagged value?


Best regards,
palim

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to use a tagged value with type memo?
« Reply #1 on: March 12, 2010, 10:21:05 pm »
Palim,

Actually that is a little trick that they did to satisfy change request I sent.
The trick is that a "memo" type tag has "<memo>" in the value field, and the Notes field of the tag is used to put the content in.

Just try entering "<memo>" (without the quotes) in the value field of a tagged value, and you will notice the appearence of the "..." button at the end.

Geert

palim

  • EA User
  • **
  • Posts: 31
  • Karma: +1/-0
    • View Profile
Re: How to use a tagged value with type memo?
« Reply #2 on: March 12, 2010, 10:59:22 pm »
Geert,

unfortunately, I don`t know how to use your answer.
I tried to set "<memo>" into a tag value where the type is "String" (the default type).
I noticed the "..." and it behaves as if you set the type for this tagged value to "memo".

So far, so good.
But, how do I have to adjust my vba script?
I still don`t know how to store content into such a tagged value.

Do I have to use something like this:

    Dim newTag As EA.TaggedValue
    Set newTag = tags.AddNew(tagName, tagValue)
          newTag.Notes = "My content ..."


Best regards,
palim

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to use a tagged value with type memo?
« Reply #3 on: March 12, 2010, 11:52:54 pm »
Yes, and use "<memo>" as tagvalue

Geert

palim

  • EA User
  • **
  • Posts: 31
  • Karma: +1/-0
    • View Profile
Re: How to use a tagged value with type memo?
« Reply #4 on: March 13, 2010, 12:02:40 am »
Geert,

thanks for your hint.
I`ve solved the problem.

For anyone interested, here`s my code snippet:

      Dim newTag1 As EA.TaggedValue
      Set newTag1 = tags.AddNew(tagName, "<memo>")
      newTag1.Update
      newTag1.Notes = tagValue
      newTag1.Update


As Geert said, it`s important to set "<memo>" as the tag`s value and then set the tag`s notes with:
newTag1.Notes = "content of this note"  
(replace "content of this note" with your text ;-) )


Best regards,
palim


Quote
Yes, and use "<memo>" as tagvalue

Geert

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: How to use a tagged value with type memo?
« Reply #5 on: March 18, 2010, 05:30:57 pm »
Hi All,

I am writing a java script to set the tagged values with <memo> type.
It adds the tagged value but when I try setting value it throws scripting error. The code is as below. Appreciate if any body points out what is wrong with this and what is the right usage

var tags as EA.Collection;
tags = currentElement.TaggedValues;            
var newTag as EA.TaggedValue;
newTag = tags.AddNew( "MyTag", "<memo>");      
newTag.Update();
newTag.Notes="my value";                  
newTag.Update()

Thanks,
pH
« Last Edit: March 18, 2010, 05:35:19 pm by praveenhg »
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: How to use a tagged value with type memo?
« Reply #6 on: March 18, 2010, 06:22:40 pm »
Hi All,
When I swithced back to 7.5 the same code works!!!.
A new bug introduced in 8.0 ?

Thanks,
pH
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>