Copy the value of Attr DXL

Was wondering if anyone knows of a slick way to copy the value from an Attr DXL attribute to another attribute, say a text or string. I've got a tool already that will copy attribute values from one to another, but it does not appear to allow copying from Attr DXL.

I could of course export the value of the attr dxl and then re-import to the other attribute, but that would be too cumbersome.

thanks
richmason - Wed Apr 15 14:14:06 EDT 2009

Re: Copy the value of Attr DXL
SystemAdmin - Thu Apr 16 03:42:22 EDT 2009

The DOORS standard Copy Attributes tool does copy values from DXL attributes to other attributes. Also in DXL if you write o."Some Attribute" = o."DXL Attribute" "" the value is copied.

Re: Copy the value of Attr DXL
dpechacek - Thu Apr 16 08:29:19 EDT 2009

The caveat of that Pekka is that the value of the DXL attribute must have been calculated. For that to happen, the attribute has to be displayed in a column or forced to be calculated.

Until then the value is null. That is likely why it appears he is not able to copy the value.

AAI Services, Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Re: Copy the value of Attr DXL
SystemAdmin - Thu Apr 16 08:38:25 EDT 2009

dpechacek - Thu Apr 16 08:29:19 EDT 2009
The caveat of that Pekka is that the value of the DXL attribute must have been calculated. For that to happen, the attribute has to be displayed in a column or forced to be calculated.

Until then the value is null. That is likely why it appears he is not able to copy the value.

AAI Services, Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Accessing DXL attribute value calculates the value, in my example the o."DXL Attribute" "" performs the calculation and gives the value. Just tested this :-)

To be really sure of this you could of course in DXL first set the DXL attribute value to be (string null) or whatever type your DXL attribute is.

Re: Copy the value of Attr DXL
dpechacek - Thu Apr 16 08:51:54 EDT 2009

SystemAdmin - Thu Apr 16 08:38:25 EDT 2009
Accessing DXL attribute value calculates the value, in my example the o."DXL Attribute" "" performs the calculation and gives the value. Just tested this :-)

To be really sure of this you could of course in DXL first set the DXL attribute value to be (string null) or whatever type your DXL attribute is.

Ok. Just making sure.

AAI Services, Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Re: Copy the value of Attr DXL
richmason - Thu Apr 16 15:54:16 EDT 2009

SystemAdmin - Thu Apr 16 03:42:22 EDT 2009
The DOORS standard Copy Attributes tool does copy values from DXL attributes to other attributes. Also in DXL if you write o."Some Attribute" = o."DXL Attribute" "" the value is copied.

the DOORS Copy Attribute tool did the trick. I had forgotten about that. Also, the DXL attribute was already calculated so no worries. thanks.

Re: Copy the value of Attr DXL
vasgyuszi - Tue Jun 14 07:55:40 EDT 2011

SystemAdmin - Thu Apr 16 03:42:22 EDT 2009
The DOORS standard Copy Attributes tool does copy values from DXL attributes to other attributes. Also in DXL if you write o."Some Attribute" = o."DXL Attribute" "" the value is copied.

Dears,

i didn't found the possibility to copy DXL attribute contents into a "normal" attribute (txt, str). My DOORS GUI shows my none of the existing DXL attributes within the module. It lists only the non-DXL attributes. I tried Tools->Functions->Copy Attributes...

Even programmed in DXL I've got this:
{code-R-E- DXL: <Line:35> null string parameter was passed into argument position 2{code}
for the line in my code:

AttrDef ad = find(current Module, attrDXLName)


But my module does well contain DXL attribute.

Thanks in advance,
vasgyuszi

Re: Copy the value of Attr DXL
llandale - Tue Jun 14 12:56:18 EDT 2011

vasgyuszi - Tue Jun 14 07:55:40 EDT 2011

Dears,

i didn't found the possibility to copy DXL attribute contents into a "normal" attribute (txt, str). My DOORS GUI shows my none of the existing DXL attributes within the module. It lists only the non-DXL attributes. I tried Tools->Functions->Copy Attributes...

Even programmed in DXL I've got this:
{code-R-E- DXL: <Line:35> null string parameter was passed into argument position 2{code}
for the line in my code:

AttrDef ad = find(current Module, attrDXLName)


But my module does well contain DXL attribute.

Thanks in advance,
vasgyuszi

The variable "attrDXLName" is pre-defined and has meaning ONLY when executed inside an Attr-DXL code. When run on-demand, such as this example, its of course null which explains your error message (it is parameter #2). Perhaps you need to do this:

AttrDef ad = find(current Module, "MyAttrDXLName")

 


The GUI will show your attr-DXL attributes. If it doesn't then they are not there.

Don't understand your statement about copying DXL Attribute contents to "normal" attributes. The Copy Attributes function should copy attribute definitions, so the target module should get the Attr-DXL as defined. That's a completely different thing then copying the CONTENTS (aka 'values') to some text attribute, which would look like perhaps this:

 

 

for obj in mod do
{  obj."MyTextAttr" = obj."MyAttrDXL"
}


Didn't investigate but I doubt the Copy Attributes function likes it when there is already an attribute with that same name in the target module; seems VERY unlikely it would replace it, with a "delete" then a "new". I know you cannot change the Type of a Def, and I'm also sure it doesn't make sense to try to change a Text attribute into an Attr-DXL, but perhaps it will let you. When you do expect to lose all the manually inserted values. If you indeed have the same attribute name in the target but it has a different purpose, I'd go ahead and re-name the target attribute, perhaps from "MyTarget" to "Old_MyTarget".

I get confused dealing with Attr-DXL and have adopted a policy of prefixing all their names with "dxl_", e.g. "dxl_CatID" is a calcuated catagory ID. I'm tempted to change policy to using a suffix, e.g. "CatID_dxl".

 

 

 

  • Louie