Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: easier way to update a enumerated type in use
Topic Summary: Help! need to update an type used in 500+ modules
Created On: 5-Jan-2006 19:35
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 5-Jan-2006 19:35
User is offline View Users Profile Print this message


Janet Ma

Posts: 115
Joined: 12-Sep-2002

I have a standard attribute in 500 + modules and have to add a new value to the attribute enumerated type. Rather than opening each module manually and adding the value by hand, has anybody come up with an easier way to do this with a script?

e.g. Test Level type, need to add to add value "Vehicles" to the enumerated type.
Attribute: Test Level

I was thinking of doing this:
1) loop through all modules
2) check if attribute type and attribute using that type exists
3) copy the attribute values to a temporary text attribute
3a) save all the existing enumerated values of the attribute type into a dynamic array
3b) append the new value "Vehicles" to the dynamic array
4) delete the existing attribute and its type (i think in that order)
5) recreate the attribute type with the appended value, recreate the attribute
6) copy the temporary text attribute values to the new attribute.
7) removing the temporary attribute.
Report this to a Moderator Report this to a Moderator
 6-Jan-2006 09:00
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

Janet,

I've already made a stab at doing what you're aiming at. The utility I've started (it's not yet complete, and I haven't looked at it for months) assumes the names of the attribute type and attribute, but presents a dialogue box to the user to enter a new enumeration for the type. The value is automatically generated, but the name is manually entered, and a colour can be associated (that bit's a bit clunky). The new enumeration can also be 'based on' an existing enumeration, which means for any object in the module that has the attribute containing the base enumeration, the new enumeration will be added. If the attribute doesn't include the base enumeration, it won't include the new enumeration. Did that make sense? I hope so!

The code is attached, and that is, after all, the ultimate documentation...

The main problem with the approach I've taken is that if someone has a module open, you won't get the access you need and that module won't be updated. This either means you have to run the utility at a 'quiet time' or go round and clean up afterwards. I think the utility leaves enough of a trail to know when it's failed in a module -- if not, you can surely add one... I'd considered the possibility of creating a trigger that checks the state of a module against a master list when it's closed, and keeping itself up to date, but I'm frankly scared of triggers, so I've avoided the issue!

Another problem is that if someone else has updated the attribute type somewhere other than the module you run the utility from, you'll lose their changes. I think you can get around this by (a) not allowing anyone else access to change the attribute type definition, and (b) keeping a 'master' module, that contains just the definitions (and maybe some documentation), from which you run the utility.

Let us all know how you get on!

Paul.

PS Got a bit of a problem attaching the files -- just remove any trailing numbers from the file names...

AddApp1.dxl
AddApp1.dxl  (15 KB)
AddApp1.inc
AddApp1.inc  (4 KB)
utils.inc
utils.inc  (22 KB)



-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive

Edited: 9-Jan-2006 at 08:33 by Paul Tiplady
Report this to a Moderator Report this to a Moderator
 6-Jan-2006 10:51
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

Alternatively, you might be able to use the runAll2.dxl script posted on this thread
Report this to a Moderator Report this to a Moderator
 6-Jan-2006 23:05
User is offline View Users Profile Print this message


Janet Ma

Posts: 115
Joined: 12-Sep-2002

Paul - I'll take a look at your scripts, do you have the utils.inc file referenced in your script?

Thanks

Janet
Report this to a Moderator Report this to a Moderator
 9-Jan-2006 08:32
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

Janet,

Sorry, must have slipped my mind. Should be attached to the original (to keep it all in one place).

Paul.

-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 12-Jan-2006 11:45
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Janet,

please refer to my post
Modify Enum Type Values

There is an easier way of handling that problem

Hope, that helps,
greetings

Reik Schröder

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.