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: modify Attribute Type
Topic Summary:
Created On: 5-Apr-2007 15:41
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-Apr-2007 15:41
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

Hello DXLiens,
this is the function for modifying attribute types.

AttrType modify(AttrType
type,string newName,string codes[ ],int values[ ],int colors[ ],string &errmess)

Now my question is what is codes and what should I use for colors in my modules it is set to default but this function needs realcolors.

If someone can give me an advice I would appreciate it.
I just want to add new values to existing enumeration types.

best regards,
Mussie

Report this to a Moderator Report this to a Moderator
 5-Apr-2007 16:05
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

You need to use the function setRealColorOptionForTypes(true) before setting colors for an enumerated attribute for colors to be right.

Color codes to use in your array are(located in DXL Reference Manual):

int realColor_Light_Blue2 
int realColor_Light_Blue 
int realColor_Dark_Turquoise 
int realColor_Pink 
int realColor_Blue 
int realColor_Maroon 
int realColor_Red 
int realColor_Yellow 
int realColor_Green 
int realColor_Cyan 
int realColor_Magenta 
int realColor_White 
int realColor_Orange 
int realColor_Brown 
int realColor_Purple 
int realColor_Navy 
int realColor_Sea_Green 
int realColor_Lime_Green 
int realColor_Rosy_Brown 
int realColor_Peru 
int realColor_Red_Grey 
int realColor_Firebrick 
int realColor_Thistle 
int realColor_Grey82 
int realColor_Grey77 
int realColor_Grey66 
int realColor_Grey55 
int realColor_Grey44 
int realColor_Grey33 
int realColor_Grey22 
int realColor_Grey11 
int realColor_Black 
int realColor_NewGrey1 
int realColor_NewGrey2 
int realColor_NewGrey3 
int realColor_NewGrey4


-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 12-Apr-2007 10:12
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

Hello,
I still don't understand what codes[] is do you have an example?
I have my example attached which results in an error:

-E- DXL:  incorrect arguments for function (modify)

sincerely,
Mussie

Report this to a Moderator Report this to a Moderator
 12-Apr-2007 10:29
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

What is the difference between values[] and codes[]?
Is codes[] the values and values[] the related number in the edit type window?

best regards,
Mussie

Report this to a Moderator Report this to a Moderator
 12-Apr-2007 13:15
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

Ok,
I understand codes are the values and the so called values are the related numbers in the edit type window.
I managed to create an attribute with color and value:
AttrType create(string name,string codes[ ],[int values[ ],[int colors[ ],]]string &errmess)

After I understood the meaning of codes, values and colors I tried to modify that attribute which didn't work out:
AttrType modify(AttrType type,string newName,string codes[ ],int values[ ],int colors[ ],string &errmess)

I didn't get an error but the attribute type is still exactly the same as before.
details on my script are attached.

any advise would be helpful
thanks
Mussie

Report this to a Moderator Report this to a Moderator
 12-Apr-2007 14:06
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

I modified your code to work
Report this to a Moderator Report this to a Moderator
 12-Apr-2007 14:47
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

Hello Ron,
you have to consider that the creation and the modification are two seperate scripts!
So there is no need to name codes, values, colors ect. differently.
That was not the problem if it was I'd probably get an error!
But I did not get an error I just could not modify the attribute type.

Mussie
Report this to a Moderator Report this to a Moderator
 12-Apr-2007 15:14
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

OK I know the problem!
Any attribute type which is used by an attribute can't be modified.
The attribute types which are not used by an attribute can be modified.

Mussie
Report this to a Moderator Report this to a Moderator
 12-Apr-2007 15:46
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

The original script from what I modified had an error message that came back as you had two many colors.

I modified the script so that it could be ran as a demo to show that the process worked. That is why I renamed your variables so it could be ran as a demo.
Report this to a Moderator Report this to a Moderator
 12-Apr-2007 15:57
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

Ok, sorry I didn't see that!
But anyway the problem is any attribute type which is used by an attribute can't be modified.
Is this correct? Or is there an easy way to manage that?
I thought of changing the attribute type Releases from the attribute Release to text, modify  Releases
and then change the attribute type of the attribute Release from text to Releases.
What do you think?
Report this to a Moderator Report this to a Moderator
 12-Apr-2007 16:35
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

You can modify enumerated values of attribute types that are currently being used by an attribute.

You can also change the base type of an attribute type.

You can not change the type of an attribute once it is created (however there apparently is an undocumented way of doing this through DXL that I'm trying to get my hands on).

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 17-Apr-2007 10:21
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

Hello David,
how can I modify attribute types that are currently being used by an attribute?
I can only modify types which are not being used by an attribute.
My code iterates through all modules of a folder and tries to modify the attribute type
Releases.
I don't have any idea how to do that,  maybe it is because I have DOORS 7.1?

Thank you for any advise

Mussie

Report this to a Moderator Report this to a Moderator
 17-Apr-2007 16:17
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

Hello,
how can I  modify enumerated values of attribute types that are currently being used by an attribute?
I understand now that I cannot change the type of an attribute.

         AttrDef ad = find(current Module, "Release")
         ad = modify(ad, object type "Text" attribute "Release")


Originally the type of the attribute was Releases.
this is the error I got:
-R-E- DXL: <Line:49> cannot change the type of an attribute
-I- DXL: execution halted

Maybe someone can help me with that.

Thanks

Mussie

Report this to a Moderator Report this to a Moderator
 19-Apr-2007 14:15
User is offline View Users Profile Print this message


Lucian Bodron

Posts: 24
Joined: 12-Oct-2005

As David said "You can not change the type of an attribute once it is created (however there apparently is an undocumented way of doing this through DXL that I'm trying to get my hands on). "

I hope this helps!

To change the type of the attribute you should first delete it and create it again with a different type.
Report this to a Moderator Report this to a Moderator
 19-Apr-2007 19:36
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Try to remember it 'DXAliens' Seesh.

The perm you quoted was modifying the type of an Enumerated type. There is a better undocumented perm that allows you to change the order of the enumerations, it looks like this:
AttrType modify(AttrType type,string newName,string codes[ ],int values[ ],int colors[ ], order[], string &errmess)

The 'order' vector has a value for each new enumeration showing which of the old enumerations this new one applies. If you change an enum type with enums "Old" and "New" and want to define a new type with enums "Recent", "Current", and "Archived" then the order vector would have values 1, -1, and 0: '1' maps Recent to New; '-1' says Current has no correspondance, and '0' maps Archived to Old.

If you figure to only add enums to the bottom of an existing pile, you don't need the above perm. I don't know what color code is associated with 'no color', but you can easily find out by finding such an AttrType and running something like this:

int i, Count = at.size
for (i=0; i<Count; i++) print i "\t" at.colors "\n"

You may need to use these:
bool RealColorOpts = getRealColorOptionForTypes() // Save current value
setRealColorOptionForTypes(true)
first, and setRealColorOptionForTypes(RealColorOpts) // Reinstate value
afterwards

The 'codes' in the modify command are the Enum values themselves, 'Old', 'Saftety' or whatever. The 'values' are the numbers you may have assigned to the codes when it was created. I think those 'values' are only useful for filtering and sorting, you can, for example, filter for objects whose 'severity' is as least 3; after defining enumerations 'Catastrophy' with 4, 'Severe' with 3, 'Troublesome' with 2, 'Annoying' with 1, and 'NA' as zero. I've never actually done that; all my Enums types have zero values. Of course you can keep them zero and filter for Severity of 'Catastrophy' or 'Severe'.

- Louie
Report this to a Moderator Report this to a Moderator
 20-Apr-2007 12:34
User is offline View Users Profile Print this message


Mussie Woldemicael

Posts: 95
Joined: 12-Sep-2006

Hello Louie,

I don't really know if need a new order.

Just take a look at the code posted on 17-Apr-2007 10:21 .
The syntay is correct I don't get an error. The problem The attribute type which is used by an attribute can't be modified.
The attribute and its type has still the same codes and values (=related numbers).
I'm not even sure if this can be done at least I don't get an error like in the post from 17-Apr-2007 16:17

cannot change the type of an attribute
-I- DXL: execution halted



best regards,
Mussie

Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 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 2 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.