Author Topic: Overwrite Tagged Values (Java API)  (Read 1717 times)

Pegasus

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Overwrite Tagged Values (Java API)
« on: January 07, 2017, 02:08:04 am »
Hello,

I don't understand API for modifiy (update) tagged values.  (EA 13)
What I want is to update existiing Tagged Values if content changed  see part of my code (part of function call)...

Collection<org.sparx.TaggedValue> elemTaVs = eaElem.GetTaggedValues();  // what means read only`?
...
tv_ptcModifDate = elemTaVs.GetByName( eaPtcFNameModifDate ); // returns null if not found
tv_ptcModifDate.SetValue( "new Date" );
if (tv_ptcModifDate.Update()) {
  updateCount++;
}

but new value isn't set in Modell (seen by Wizard in Model)

Thanks for support
Pegasus

qwerty

  • EA Guru
  • *****
  • Posts: 10631
  • Karma: +234/-195
  • I'm no guru at all
    • View Profile
Re: Overwrite Tagged Values (Java API)
« Reply #1 on: January 07, 2017, 03:54:32 am »
Might be that you have duplicate TVs. I recommend to not use GetByName or to use your own version of that. You will not get defined results if you have duplicate names. Go set the "Show Duplicate Tags" with the options button in the TV window.

q.

Pegasus

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: Overwrite Tagged Values (Java API)
« Reply #2 on: January 09, 2017, 11:06:05 pm »
Hello
I found "problem". It was part of setValue-parameter. In real code "new Date" ist result of an other api call  (Java API of PTCIntegrity) and this seems not to be well done by me. If I assing result to String variable first and call SetValute (strVal) afterwards, all is fine.