How to print out all the module attributes' values by DXL?

Hi folks,

I wrote a DXL code to print out all the module attributes' values. But it looks like does not work. Below error message will pop up:

+-R-E- DXL: <Line:13> unknown Module attribute (Absolute Number)
-I- DXL: execution halted+

This is my DXL code:

Module mod = current
 
AttrDef ad
 
string as =""
 
for ad in mod do
 
{
 
as=ad.name
 
print mod.as "\n"
 
}

Edward_Wang - Tue Mar 22 02:33:34 EDT 2011

Re: How to print out all the module attributes' values by DXL?
Edward_Wang - Tue Mar 22 02:47:19 EDT 2011

By the way, the current module is a link module. I found the Absolute Number and Link Type attributes will cause this error.

Is there any different between them and other attributes?

Edward

Re: How to print out all the module attributes' values by DXL?
SystemAdmin - Tue Mar 22 03:03:09 EDT 2011

Edward_Wang - Tue Mar 22 02:47:19 EDT 2011
By the way, the current module is a link module. I found the Absolute Number and Link Type attributes will cause this error.

Is there any different between them and other attributes?

Edward

Some attributes are defined for module, some for objects and some for both module and objects. The attribute "Absolute Number" is defined only for objects. So, if you want to print module attributes, you have to check for that in your code:
 

Module mod = current
 
AttrDef ad
 
string as =""
 
for ad in mod do
 
{ 
   if (ad.module)
     {
      as=ad.name
      print as ": " mod.as "\n"
     }
}

Re: How to print out all the module attributes' values by DXL?
Edward_Wang - Tue Mar 22 03:38:00 EDT 2011

SystemAdmin - Tue Mar 22 03:03:09 EDT 2011

Some attributes are defined for module, some for objects and some for both module and objects. The attribute "Absolute Number" is defined only for objects. So, if you want to print module attributes, you have to check for that in your code:
 

Module mod = current
 
AttrDef ad
 
string as =""
 
for ad in mod do
 
{ 
   if (ad.module)
     {
      as=ad.name
      print as ": " mod.as "\n"
     }
}

Pekka,
Thank you very much.

I know my mistake. And very try again.

Edward

Re: How to print out all the module attributes' values by DXL?
Edward_Wang - Tue Mar 22 05:32:16 EDT 2011

Edward_Wang - Tue Mar 22 03:38:00 EDT 2011
Pekka,
Thank you very much.

I know my mistake. And very try again.

Edward

Another problem,

If I want to get the attributes' value list which scope is object, what should I do?

Can you give me some clue?

Re: How to print out all the module attributes' values by DXL?
Mathias Mamsch - Tue Mar 22 05:36:20 EDT 2011

Edward_Wang - Tue Mar 22 05:32:16 EDT 2011
Another problem,

If I want to get the attributes' value list which scope is object, what should I do?

Can you give me some clue?

What exactly do you mean by "attribute value list"? A list of all values of a certain object attribute? A list of all object attributes? Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: How to print out all the module attributes' values by DXL?
llandale - Tue Mar 22 11:58:50 EDT 2011

Edward_Wang - Tue Mar 22 05:32:16 EDT 2011
Another problem,

If I want to get the attributes' value list which scope is object, what should I do?

Can you give me some clue?

ad.object returns boolean, true when the attribute applies to objects. As stated ad.module returns boolean, true when the attribute applies to the Module. An attribute can be either or both, but cannot be neither.

Re: How to print out all the module attributes' values by DXL?
Edward_Wang - Wed Mar 23 01:05:06 EDT 2011

Mathias Mamsch - Tue Mar 22 05:36:20 EDT 2011
What exactly do you mean by "attribute value list"? A list of all values of a certain object attribute? A list of all object attributes? Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Hi Mathias,

Maybe my description make you confused. What exactly I want:

In the link module, I really want to get the value of the attribute which scope is object(or include object). I don't know how to do that. But I know how to get all the value of the attribute which scope is module(or include module). See my code.
 

Module mod =current
AttrDef ad
string as=""
 
for ad in mod do
{
    if(ad.module)
        {
                as=ad.name
                print mod.as "\n"  //print out all the values of module attributes
        }
        if(ad.object)
        {
                as=ad.name
                print ???          //How to print out all the values of object attributes?
        }
}

Re: How to print out all the module attributes' values by DXL?
Edward_Wang - Wed Mar 23 01:07:34 EDT 2011

Edward_Wang - Wed Mar 23 01:05:06 EDT 2011

Hi Mathias,

Maybe my description make you confused. What exactly I want:

In the link module, I really want to get the value of the attribute which scope is object(or include object). I don't know how to do that. But I know how to get all the value of the attribute which scope is module(or include module). See my code.
 

Module mod =current
AttrDef ad
string as=""
 
for ad in mod do
{
    if(ad.module)
        {
                as=ad.name
                print mod.as "\n"  //print out all the values of module attributes
        }
        if(ad.object)
        {
                as=ad.name
                print ???          //How to print out all the values of object attributes?
        }
}

Mathias,

Please pay attention, the module is a Link Module. It's not a Formal Module.
Really need your help.

Thanks and regards.
Edward.

Re: How to print out all the module attributes' values by DXL?
Mathias Mamsch - Wed Mar 23 04:06:40 EDT 2011

Edward_Wang - Wed Mar 23 01:07:34 EDT 2011
Mathias,

Please pay attention, the module is a Link Module. It's not a Formal Module.
Really need your help.

Thanks and regards.
Edward.

You should know that the "objects" of Link Module are the Linksets. So you can do as with every formal Module, there is really no difference:
 

Module myLinkModule = current
Object o
AttrDef ad
 
for ad in myLinkModule do {
   if (ad.module) {
      string sAttrName = ad.name
      print "Module Attribute: " sAttrName " -> " (myLinkModule.sAttrName)  "\n"
   }
}
 
 
for o in myLinkModule do {
    for ad in myLinkModule do {
       string sAttrName = ad.name
           if (ad.object) { print "Attribute:" sAttrName " -> " o.sAttrName "\n" }
 
           Linkset LS = linkset o  // use this if you prefer to use Linkset objects
    }      
}

 


Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: How to print out all the module attributes' values by DXL?
llandale - Wed Mar 23 10:50:23 EDT 2011

Edward_Wang - Wed Mar 23 01:05:06 EDT 2011

Hi Mathias,

Maybe my description make you confused. What exactly I want:

In the link module, I really want to get the value of the attribute which scope is object(or include object). I don't know how to do that. But I know how to get all the value of the attribute which scope is module(or include module). See my code.
 

Module mod =current
AttrDef ad
string as=""
 
for ad in mod do
{
    if(ad.module)
        {
                as=ad.name
                print mod.as "\n"  //print out all the values of module attributes
        }
        if(ad.object)
        {
                as=ad.name
                print ???          //How to print out all the values of object attributes?
        }
}

I wonder if this will help. As Mathias said an 'Object' in a link module corresponds to a 'LinkSet'. There are attributes in a link module and you can create your own custom ones.

Not stated is that a 'Link' is not stored in the Link Module, its instead stored in the formal module that sources the link. The values of link attributes are likewise stored in the formal source module.

So you can get information about 'LinkSet's by opening the link module, either dealing with 'Object's or dealing with 'LinkSet's. You can get information about 'Link's by openning the formal module that houses the link, going to the source object, then looping through its 'Link's. Link attributes can be then accessed such as <lnk."Created On" or lnk."MyCustomLinkAttr">.

I modified Mathias' print code to make it a little easier to see. You can paste the results into Excel, but first change all the cells from "General" format to "Text".

Module myLinkModule = current
Object o
AttrDef ad
 
//for ad in myLinkModule do {
//   if (ad.module) {
//      string sAttrName = ad.name
//      print "Module Attribute: " sAttrName " -> " (myLinkModule.sAttrName)  "\n"
//   }
//}
        // Print Attr-Name Headings
print "ObjID"
for ad in myLinkModule do
{  string sAttrName = ad.name
   if (ad.object) { print "\t" sAttrName }
}
print "\n"
 
for o in myLinkModule do {
    print identifier(o) 
    for ad in myLinkModule do {
           string sAttrName = ad.name
           if (ad.object) { print "\t" o.sAttrName ""}
 
           //Linkset LS = linkset o  // use this if you prefer to use Linkset objects
    }     
    print "\n" 
}

 

  • Louie

 

Re: How to print out all the module attributes' values by DXL?
Edward_Wang - Thu Mar 24 00:23:26 EDT 2011

llandale - Wed Mar 23 10:50:23 EDT 2011

I wonder if this will help. As Mathias said an 'Object' in a link module corresponds to a 'LinkSet'. There are attributes in a link module and you can create your own custom ones.

Not stated is that a 'Link' is not stored in the Link Module, its instead stored in the formal module that sources the link. The values of link attributes are likewise stored in the formal source module.

So you can get information about 'LinkSet's by opening the link module, either dealing with 'Object's or dealing with 'LinkSet's. You can get information about 'Link's by openning the formal module that houses the link, going to the source object, then looping through its 'Link's. Link attributes can be then accessed such as <lnk."Created On" or lnk."MyCustomLinkAttr">.

I modified Mathias' print code to make it a little easier to see. You can paste the results into Excel, but first change all the cells from "General" format to "Text".

Module myLinkModule = current
Object o
AttrDef ad
 
//for ad in myLinkModule do {
//   if (ad.module) {
//      string sAttrName = ad.name
//      print "Module Attribute: " sAttrName " -> " (myLinkModule.sAttrName)  "\n"
//   }
//}
        // Print Attr-Name Headings
print "ObjID"
for ad in myLinkModule do
{  string sAttrName = ad.name
   if (ad.object) { print "\t" sAttrName }
}
print "\n"
 
for o in myLinkModule do {
    print identifier(o) 
    for ad in myLinkModule do {
           string sAttrName = ad.name
           if (ad.object) { print "\t" o.sAttrName ""}
 
           //Linkset LS = linkset o  // use this if you prefer to use Linkset objects
    }     
    print "\n" 
}

 

  • Louie

 

Thank you all for the help.

Re: How to print out all the module attributes' values by DXL?
ravikiran.Talekar - Wed Sep 03 01:25:04 EDT 2014

SystemAdmin - Tue Mar 22 03:03:09 EDT 2011

Some attributes are defined for module, some for objects and some for both module and objects. The attribute "Absolute Number" is defined only for objects. So, if you want to print module attributes, you have to check for that in your code:
 

Module mod = current
 
AttrDef ad
 
string as =""
 
for ad in mod do
 
{ 
   if (ad.module)
     {
      as=ad.name
      print as ": " mod.as "\n"
     }
}

Hi,

i am getting below error while running a dxl script.

3.dxl:876> unknown Object attribute (Table_ID_Copy)

could you please explain the error.

Thanks in advance.

Ravikiran

Re: How to print out all the module attributes' values by DXL?
Mike.Scharnow - Wed Sep 03 03:22:02 EDT 2014

ravikiran.Talekar - Wed Sep 03 01:25:04 EDT 2014

Hi,

i am getting below error while running a dxl script.

3.dxl:876> unknown Object attribute (Table_ID_Copy)

could you please explain the error.

Thanks in advance.

Ravikiran

It means you have a script which deals with a certain module and for one of the objects of this module your script wants to get the value of the attribute "Table_ID_Copy".

But the module that is opened does not contain the attribute "Table_ID_Copy".

 

So, either your module has the wrong structure or your script has the wrong list of attributes to be retrieved.

Re: How to print out all the module attributes' values by DXL?
llandale - Wed Sep 03 14:15:25 EDT 2014

ravikiran.Talekar - Wed Sep 03 01:25:04 EDT 2014

Hi,

i am getting below error while running a dxl script.

3.dxl:876> unknown Object attribute (Table_ID_Copy)

could you please explain the error.

Thanks in advance.

Ravikiran

Edit that attribute you will find it is defined for the "module" but not for "objects"; or it doesn't exist at all.

Re: How to print out all the module attributes' values by DXL?
ravikiran.Talekar - Thu Sep 04 00:19:24 EDT 2014

llandale - Wed Sep 03 14:15:25 EDT 2014

Edit that attribute you will find it is defined for the "module" but not for "objects"; or it doesn't exist at all.

Thank you Mike and llandale,

You guys were right, i added the value, its working now.

Thanks a lot.

Re: How to print out all the module attributes' values by DXL?
ravikiran.Talekar - Fri Nov 14 05:05:38 EST 2014

OLE object disabled in DOORS. Hoe can i fix this. I need to inseret OLE Object in the module