Book a Demo

Author Topic: Change Type for MANY attributes?  (Read 3814 times)

ChuckZ

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Change Type for MANY attributes?
« on: August 10, 2012, 02:06:48 am »
Is there a way to "batch" change the type of many attributes? My problem is that I currently have attributes typed as primitives and desire to all of those primitives to a specifically named type def.

Is there a way to do a find AND REPLACE for types?
Where's your shame … You've left us up to our necks in it … - David Bowie (Hunky Dory – 1971)
All that is necessary for the triumph of evil is that good men do nothing. - Edmund Burke (1729-1797)

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Change Type for MANY attributes?
« Reply #1 on: August 10, 2012, 04:51:23 am »
Maybe it's possible to use an appropriate UPDATE statement directly on the database to achieve this. But there are more experienced experts than me lurking on this user forum to give you a possible example how such UPDATE statement could look like.

Look forward, may be specify your conditions more exactly to match the attributes you want to change.

Best regards,
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Change Type for MANY attributes?
« Reply #2 on: August 10, 2012, 04:56:13 pm »
Chuck,

The cleanest solution would be to write a little script/add-in that replaces the type of the attributes.
Now because that is still a bit of work, I would probably opt for the dirtier SQL update approach.

You will need to set the Classifier column on the t_attribute table to the ObjectID of the datatype.

I would use a query as following:
Code: [Select]
select *
--update a set a.Classifier = 2146289599
from t_attribute a
where a.Type like 'DateType'
and (a.Classifier = 0 OR a.Classifier is null)

Geert


ChuckZ

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: Change Type for MANY attributes?
« Reply #3 on: August 11, 2012, 06:24:40 am »
Thanks Guys!

SQL is better than making errors by hand-jamming
Where's your shame … You've left us up to our necks in it … - David Bowie (Hunky Dory – 1971)
All that is necessary for the triumph of evil is that good men do nothing. - Edmund Burke (1729-1797)