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: Adventures in modifying enumerated types
Topic Summary:
Created On: 18-Aug-2004 11:27
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.
 18-Aug-2004 11:27
User is offline View Users Profile Print this message


Stuart Gilbey

Posts: 4
Joined: 14-May-2003

I’m currently developing a utility to modify attributes and types across multiple modules. I thought I’d share my findings regarding modifying enumerated attribute types as this area is poorly (and incorrectly) documented in the dxl manual.

It’s possible to make the following changes relatively easily:

- Modify the string of any value in the list
- Delete an existing value from the end of the list
- Add a new value to the end of the list

However, it becomes much more complex when deleting or inserting a value at any other point in the list. This seems to be due to the mapping.

Say we have 3 values in an enumerated type with associated mapping:

Value mapping
A 0
B 1
C 2

If we want to insert X between A and B the mapping for the existing values must not change:

A 0
X 3
B 1
C 2

This can be achieved once but the problem is that there doesn’t seem to be any way of obtaining the existing mapping and so it would not be possible to modify the type again.

When modifying the type, if the mapping was set to 0, 1, 2, 3 all the values in the attribute would change (with no change bars or history). Very dangerous!

The edit types dialogue seems to manage this as following any inserting, moving etc, the mapping still seems to be 0, 1, 2, 3, 4.

If anyone has a solution to this I’d be very interested!


-------------------------
Stuart Gilbey
C4 Systems Limited
www.c4systems.co.uk
Report this to a Moderator Report this to a Moderator
 18-Aug-2004 14:52
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

You should probably adopt a new strategy featuring creating a whole new attribute, as follows:
- Rename the current attr def to "-old".
- Rename the current attr type to "-old"
- Read the Enumerations from the Type -old and create a new type based on that info, but inserting as you see fit. Actually, you'd create the new type via arrays in your DXL
- Create a new Attr Def.
- For every object, copy the -old value to the New.
- Delete the -old type and def.

Advanced DXL will create the new with History off; but "modify" the attr definition to turn History on after the copy.

You won't lose History with this method since last weeks History mods to the attribute will have the same attr name as next week's.

- Louie
Report this to a Moderator Report this to a Moderator
 22-Feb-2007 15:52
User is offline View Users Profile Print this message


Thomas Langholz

Posts: 40
Joined: 20-Oct-2005

Hi Stuart, did you complete your maintenance-tool? i would be very glad if you could publish it to our community greetings thomas
Report this to a Moderator Report this to a Moderator
 16-Mar-2007 20:56
User is offline View Users Profile Print this message


Chris Jones

Posts: 177
Joined: 1-Jul-2005

quote:

Originally posted by: Stuart Gilbey
It's possible to make the following changes relatively easily:

- Add a new value to the end of the list



Does "relatively easily" mean "by getting all the values and making a new array one bigger than the previous, and then loading that into the type definition"? As in this topic? The manual doesn't say anything that I can find, but the idea in the other topic is essentially the same as what I came up with. Seems like a long way 'round if it's the only way.

Chris
Report this to a Moderator Report this to a Moderator
 19-Mar-2007 16:23
User is offline View Users Profile Print this message


Leonard Walker

Posts: 9
Joined: 22-Nov-2005

Okay... I have been working on this currently. I am working on a script that allows for the maintenance of an ESR or WAD enurated type. I have completed the code for adding to the end of the enumeration or modifying one that currently exists. I am attaching the code if you care. It is ugly, but it works for now. I Will be adding the functioniality of delete and doing some clean up. 

As you mentnioned on top of the manual being wrong for this call, there is supposable a function call enureration.string[] that will allow you to get the mapping information. Have not tried it yet, and I received this from the tech support.

You willl have to set up a temp array of the right size. It sucks that dxl does not allow dynamic arrays, and will not allow you to pass an array if some of the field are null.

Hope this helps anyone that needs it.
Report this to a Moderator Report this to a Moderator
 22-Nov-2007 10:10
User is offline View Users Profile Print this message


Jon Martin

Posts: 49
Joined: 22-Nov-2006

Hi Leonard

Can you paste the IncludeFiles for this script?
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 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 0 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.