Convert a DXL Attribute to Text

Normally you cannot change the type of an attribute but you can change a DXL Attribute to text, thereby preserving the calculated values, using the DOORS standard attribute GUI by just removing the tick. Does anyone know how to execute the same operation in DXL?

I do not want to copy the values to a new attribute if this can be avoided.

I have searched the command database, this forum and even the old telelogic forums for the perm but am unable to find the solution.
GordonWoods - Mon Aug 13 17:41:07 EDT 2012

Re: Convert a DXL Attribute to Text
llandale - Tue Aug 14 13:36:00 EDT 2012

Didn't realize you could do that.

See DXL manual chapter "Attributes"; section "modify(attribute definition)"; functionn "modify(attribute definition)"
Try this:
  • AttrDef adNew = null, adOld = find(mod, "NameAttrDXL")
  • modify(adOld, setDXL "", adNew)

It knows it's not an Attr-DXL if there is null Attr-DXL Code.

-Louie

Re: Convert a DXL Attribute to Text
SystemAdmin - Wed Aug 15 17:05:30 EDT 2012

llandale - Tue Aug 14 13:36:00 EDT 2012
Didn't realize you could do that.

See DXL manual chapter "Attributes"; section "modify(attribute definition)"; functionn "modify(attribute definition)"
Try this:

  • AttrDef adNew = null, adOld = find(mod, "NameAttrDXL")
  • modify(adOld, setDXL "", adNew)

It knows it's not an Attr-DXL if there is null Attr-DXL Code.

-Louie

Hello,

couldn't you just code the dxl code to be static for baselines by using "baselineInfo"?
 

Baseline b = baselineInfo(m) 
if(!null b)
{//do something only to current}
else{//do nothing if baselined}

 


-Jim

 

Re: Convert a DXL Attribute to Text
SystemAdmin - Wed Aug 15 17:06:53 EDT 2012

SystemAdmin - Wed Aug 15 17:05:30 EDT 2012

Hello,

couldn't you just code the dxl code to be static for baselines by using "baselineInfo"?
 

Baseline b = baselineInfo(m) 
if(!null b)
{//do something only to current}
else{//do nothing if baselined}

 


-Jim

 

typo sorry!!
 

Baseline b = baselineInfo(m) 
if(null b)
{//do something only to current}
else{//do nothing if baselined}

Re: Convert a DXL Attribute to Text
llandale - Thu Aug 16 12:03:56 EDT 2012

llandale - Tue Aug 14 13:36:00 EDT 2012
Didn't realize you could do that.

See DXL manual chapter "Attributes"; section "modify(attribute definition)"; functionn "modify(attribute definition)"
Try this:

  • AttrDef adNew = null, adOld = find(mod, "NameAttrDXL")
  • modify(adOld, setDXL "", adNew)

It knows it's not an Attr-DXL if there is null Attr-DXL Code.

-Louie

  • modify(adNew, setName "NameAttrDXL_Baseline_1.1(a)", adNew)

-Louie

This perhaps is a reasonable basis for preserving AttrDXL values before baselining.

Let me think out loud...
  • Before baselining (e.g. to "1.2(b)")
    • for each Attr-DXL in the module
      • copy that Attr-DEF to NameAttrDXL "Baseline_1.2(b)"
      • for all objects {string s = obj.Name of the new attribute} // access all object values
      • change the baselined attribute to no longer be attr-DXL
  • Baseline

I guess that still has the problem that the attr-DXL is still in the baseline and also still in the various views; but the new text attribute is not.

Getting rather carried away, the DXL itself could determine if it is running in a baseline, and if so just display the preserved value from the Text attribute corresponding to the baseline (if it exists); otherwise calculate it normally.

Re: Convert a DXL Attribute to Text
llandale - Thu Aug 16 12:11:15 EDT 2012

llandale - Thu Aug 16 12:03:56 EDT 2012

  • modify(adNew, setName "NameAttrDXL_Baseline_1.1(a)", adNew)

-Louie

This perhaps is a reasonable basis for preserving AttrDXL values before baselining.

Let me think out loud...
  • Before baselining (e.g. to "1.2(b)")
    • for each Attr-DXL in the module
      • copy that Attr-DEF to NameAttrDXL "Baseline_1.2(b)"
      • for all objects {string s = obj.Name of the new attribute} // access all object values
      • change the baselined attribute to no longer be attr-DXL
  • Baseline

I guess that still has the problem that the attr-DXL is still in the baseline and also still in the various views; but the new text attribute is not.

Getting rather carried away, the DXL itself could determine if it is running in a baseline, and if so just display the preserved value from the Text attribute corresponding to the baseline (if it exists); otherwise calculate it normally.

Further thinking...

  • There is a single "_Baselined" text attribute for each attrDXL.
  • Before baseling, copy each attr-DXL values to its corresponding _Baselined attribute
  • The Attr-DXL when running in a baseline, displays the value of it's corresponding _Baseline attr.

Thus each Baseline has the latest version of the attr-DXL. The Baselined attr need not appear in a view, but it can.

Re: Convert a DXL Attribute to Text
GordonWoods - Thu Aug 23 11:58:19 EDT 2012

llandale - Tue Aug 14 13:36:00 EDT 2012
Didn't realize you could do that.

See DXL manual chapter "Attributes"; section "modify(attribute definition)"; functionn "modify(attribute definition)"
Try this:

  • AttrDef adNew = null, adOld = find(mod, "NameAttrDXL")
  • modify(adOld, setDXL "", adNew)

It knows it's not an Attr-DXL if there is null Attr-DXL Code.

-Louie

Hi Louie

Yes your response was pretty much spot on; and after you pointed it ou I had a doh! moment thinking back to how many times I had inadvertantly deleted the DXL code .....

The reason to do this in the first place was when transferring modules from company to company - when the attribute DXL is saved on the source company DOORS server - and of course the target company has no access to this but it could equally apply to baselines as you and James pointed out.

Many thanks.

I ended up using something like this

// check the links are refreshed by opening incoming and outgoing links for all module objects

// refresh the DXL by setting to null (I understand IBM have finally fixed the DXL thrashing on this)

// reset DXL attributes to non DXL using ( variables defined of course )

for ad in currentModule do {

if (ad.dxl) {
// check that the user has access to modify
if ( ( canCreateDef ad ) && ( canControlDef ad ) ) {
strAttrName = ad.name

ad = modify(ad, setDXL, nullStringValue)
print "Changed DXL Attribute '" strAttrName "' to text.\n"

}
}
} // end for ad

Re: Convert a DXL Attribute to Text
llandale - Thu Aug 23 12:22:01 EDT 2012

GordonWoods - Thu Aug 23 11:58:19 EDT 2012
Hi Louie

Yes your response was pretty much spot on; and after you pointed it ou I had a doh! moment thinking back to how many times I had inadvertantly deleted the DXL code .....

The reason to do this in the first place was when transferring modules from company to company - when the attribute DXL is saved on the source company DOORS server - and of course the target company has no access to this but it could equally apply to baselines as you and James pointed out.

Many thanks.

I ended up using something like this

// check the links are refreshed by opening incoming and outgoing links for all module objects

// refresh the DXL by setting to null (I understand IBM have finally fixed the DXL thrashing on this)

// reset DXL attributes to non DXL using ( variables defined of course )

for ad in currentModule do {

if (ad.dxl) {
// check that the user has access to modify
if ( ( canCreateDef ad ) && ( canControlDef ad ) ) {
strAttrName = ad.name

ad = modify(ad, setDXL, nullStringValue)
print "Changed DXL Attribute '" strAttrName "' to text.\n"

}
}
} // end for ad

Does that work even if you fail to first retrieve all Object values for the Attr-DXL? At the moment you remove the code, the obj-attr value is null.

-Louie