Creating Object headings via script

Hi,

Is it possible to create object headings via DXL as we create the module with DXL? That way I could generate a whole module with predefined headings.

In addition, do you think a Revision Table can be made before the first object heading? This records all changes to the module version and who made them on which date.

Thanks,

TooDiff
TooDifficult - Thu Jan 06 22:52:00 EST 2011

Re: Creating Object headings via script
PDU - Fri Jan 07 01:20:10 EST 2011

Hi,

look the attached file.

Pierre
Attachments

attachment_14568974_HeadinsAttributViews_DXLcreate.zip

Re: Creating Object headings via script
Mathias Mamsch - Fri Jan 07 05:12:50 EST 2011

Depending on what you want to do, you could also make a "Template Module", which you then just copy to the right position using DXL. Sometimes that can be easier, since you can do all that definitions (attributes, types, views, module structure, etc.) in the template module an need no DXL to create that on the fly. Of course maintaining DOORS module templates can be troublesome, especially if you plan to put them under version control. But I thought it might be worth thinking about it, regards, Mathias


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

Re: Creating Object headings via script
SystemAdmin - Fri Jan 07 16:31:28 EST 2011

That way I could generate a whole module with predefined headings

Sounds like you want to create templates - as Mathius has already pointed out, it's possibly easier to create a template manually from a blank formal module rather than via DXL. They can be located under a folder and users can then copy and paste the template into another folder and start work. For each template doc type, just build up a blank formal module with the attributes, views and headings required to support the document type. I would recommend prefixing each template view with a number so that they always sit at the top of the view list and don't get mixed up with users views - also set the access permissions on these views so that users can't fiddle with them. I've been doing it this way for years, seems to be the easiest option.

This records all changes to the module version and who made them on which date

Yes - you can place a table structure before the first heading - are you wanting to populate this revision history table automatically via DXL or will users do this manually?

Paul Miller
Melbourne, Australia

Re: Creating Object headings via script
TooDifficult - Mon Jan 10 00:04:20 EST 2011

SystemAdmin - Fri Jan 07 16:31:28 EST 2011
That way I could generate a whole module with predefined headings

Sounds like you want to create templates - as Mathius has already pointed out, it's possibly easier to create a template manually from a blank formal module rather than via DXL. They can be located under a folder and users can then copy and paste the template into another folder and start work. For each template doc type, just build up a blank formal module with the attributes, views and headings required to support the document type. I would recommend prefixing each template view with a number so that they always sit at the top of the view list and don't get mixed up with users views - also set the access permissions on these views so that users can't fiddle with them. I've been doing it this way for years, seems to be the easiest option.

This records all changes to the module version and who made them on which date

Yes - you can place a table structure before the first heading - are you wanting to populate this revision history table automatically via DXL or will users do this manually?


Paul Miller
Melbourne, Australia

Hi, thanks for the replies!

I'll have a look at that zip file.

Yes, I am in fact creating a template, but the reason why I haven't used the manual method is because I've already created the script for module generation.

I've got this customized toolkit set up already, so at the moment it will choke up a new project template that has all the bits my company usually uses.

That's why I thought that populating modules via DXL would be more efficient...

The modules come up already with all the views, etc. They're grouped in such a way no common combination of text will separate these specific views.

The headings have also been generated via DXL and so have the attributes and their attribute types.

All I need now is to populate the thing, so employees can just enter underneath each heading.

Is this do-able? I guess I am willing to invest in any amount of code to do it. Besides being very automated,...it sure makes things impressive : P

TooDiff

Re: Creating Object headings via script
TooDifficult - Mon Jan 10 00:07:57 EST 2011

TooDifficult - Mon Jan 10 00:04:20 EST 2011
Hi, thanks for the replies!

I'll have a look at that zip file.

Yes, I am in fact creating a template, but the reason why I haven't used the manual method is because I've already created the script for module generation.

I've got this customized toolkit set up already, so at the moment it will choke up a new project template that has all the bits my company usually uses.

That's why I thought that populating modules via DXL would be more efficient...

The modules come up already with all the views, etc. They're grouped in such a way no common combination of text will separate these specific views.

The headings have also been generated via DXL and so have the attributes and their attribute types.

All I need now is to populate the thing, so employees can just enter underneath each heading.

Is this do-able? I guess I am willing to invest in any amount of code to do it. Besides being very automated,...it sure makes things impressive : P

TooDiff

Hi Pierre,

Many thanks for the code; it looks like exactly what I need but I don't understand a few things;

What is the Module_AttributsWEXP file doing?

Thanks,

TooDiff

Re: Creating Object headings via script
PDU - Mon Jan 10 01:37:50 EST 2011

TooDifficult - Mon Jan 10 00:07:57 EST 2011
Hi Pierre,

Many thanks for the code; it looks like exactly what I need but I don't understand a few things;

What is the Module_AttributsWEXP file doing?

Thanks,

TooDiff

Hi,

we use TXEP (Doors Trek Exporter) to generate Word document from Doors modules.

Module_AttributsWEXP file create attributs used by this tool (all WEXP... attributs) and attributs used in the document as title, author, ... (all WORD... attributs).

WEXP attributs are not useful for you.

Pierre

Re: Creating Object headings via script
TooDifficult - Mon Jan 10 16:41:40 EST 2011

PDU - Mon Jan 10 01:37:50 EST 2011
Hi,

we use TXEP (Doors Trek Exporter) to generate Word document from Doors modules.

Module_AttributsWEXP file create attributs used by this tool (all WEXP... attributs) and attributs used in the document as title, author, ... (all WORD... attributs).

WEXP attributs are not useful for you.

Pierre

Hi Pierre thanks for the reply.

So which part of the code is actually creating the headings inside the module?

Initially I thought it was the create object type etc, but you just said it creates the Word document format.

Which code file is inserting object headings into an empty module?

Thanks,

TooDiff

Re: Creating Object headings via script
SystemAdmin - Mon Jan 10 17:23:32 EST 2011

TooDifficult - Mon Jan 10 16:41:40 EST 2011
Hi Pierre thanks for the reply.

So which part of the code is actually creating the headings inside the module?

Initially I thought it was the create object type etc, but you just said it creates the Word document format.

Which code file is inserting object headings into an empty module?

Thanks,

TooDiff

Which code file is inserting object headings into an empty module?

The easiest way to insert a heading structure into an empty module is to use the DXL Template function - this function will insert a defined heading structure for you - see the example code below - try it - just copy the code and run it inside of an empty module. To understand the syntax, you will need to look up this function in the DXL reference manual (did you know that a copy of the DXL Ref manual is under the DOORS Help menu? Enter "template" into the Help Index tab).

This example is just an extract from existing DXL code used by the DOORS client. DOORS has a library of ready to use heading templates - select Insert > Template from the module menu - you will see a listing of some widely used documentation standards, and under these is a list of the document types that each standard supports. This library just uses DXL files, you can find them under ...\IBM\Rational\DOORS\9.2\lib\dxl\standard\template. You might find that some of these heading templates contain most of what you want and just need to be modified to suit. To understand what each heading is about and what content should go under them, you will need to get a copy of the documentation standards themselves.

 

 

Template A = template "SCOPE" 
  "APPLICABLE DOCUMENTS" <<
    "Government Documents" 
    "Non-Government Document" >> 1 
  "REQUIREMENTS" <<
    "Definition" 
    "Characteristics" <<
      "Performance Characteristics" 
      "Physical Characteristics" 
      "Reliability" 
      "Maintainability" 
      "Environmental Conditions" 
      "Transportability" >> 1 
    "Design and Construction" <<
      "Materials" 
      "Electromagnetic Radiation" 
      "Nameplates or Product Markings" 
      "Workmanship" 
      "Interchangeability" 
      "Safety" 
      "Human Engineering"
 
instance A

 

 

 

 


Paul Miller
Melbourne, Australia

 

 

Re: Creating Object headings via script
TooDifficult - Mon Jan 10 23:24:55 EST 2011

SystemAdmin - Mon Jan 10 17:23:32 EST 2011

Which code file is inserting object headings into an empty module?

The easiest way to insert a heading structure into an empty module is to use the DXL Template function - this function will insert a defined heading structure for you - see the example code below - try it - just copy the code and run it inside of an empty module. To understand the syntax, you will need to look up this function in the DXL reference manual (did you know that a copy of the DXL Ref manual is under the DOORS Help menu? Enter "template" into the Help Index tab).

This example is just an extract from existing DXL code used by the DOORS client. DOORS has a library of ready to use heading templates - select Insert > Template from the module menu - you will see a listing of some widely used documentation standards, and under these is a list of the document types that each standard supports. This library just uses DXL files, you can find them under ...\IBM\Rational\DOORS\9.2\lib\dxl\standard\template. You might find that some of these heading templates contain most of what you want and just need to be modified to suit. To understand what each heading is about and what content should go under them, you will need to get a copy of the documentation standards themselves.

 

 

Template A = template "SCOPE" 
  "APPLICABLE DOCUMENTS" <<
    "Government Documents" 
    "Non-Government Document" >> 1 
  "REQUIREMENTS" <<
    "Definition" 
    "Characteristics" <<
      "Performance Characteristics" 
      "Physical Characteristics" 
      "Reliability" 
      "Maintainability" 
      "Environmental Conditions" 
      "Transportability" >> 1 
    "Design and Construction" <<
      "Materials" 
      "Electromagnetic Radiation" 
      "Nameplates or Product Markings" 
      "Workmanship" 
      "Interchangeability" 
      "Safety" 
      "Human Engineering"
 
instance A

 

 

 

 


Paul Miller
Melbourne, Australia

 

 

Hi,

Thanks for this. I'll give it a shot and get back to you.

Thanks!

TooDiff

Re: Creating Object headings via script
TooDifficult - Mon Jan 10 23:27:56 EST 2011

TooDifficult - Mon Jan 10 23:24:55 EST 2011
Hi,

Thanks for this. I'll give it a shot and get back to you.

Thanks!

TooDiff

Hi Paul,

Forgot to answer your previous question; I am hoping that I can do the revision table update via DXL as there's more automation, but if that's not possible then I will be fine with just manual.

Can this table be inserted via, again, DXL?

Thanks,

Dillon

Re: Creating Object headings via script
SystemAdmin - Tue Jan 11 00:21:27 EST 2011

TooDifficult - Mon Jan 10 23:27:56 EST 2011
Hi Paul,

Forgot to answer your previous question; I am hoping that I can do the revision table update via DXL as there's more automation, but if that's not possible then I will be fine with just manual.

Can this table be inserted via, again, DXL?

Thanks,

Dillon

Can this table be inserted via, again, DXL?

Yep, sure can - as an example, something like the following will insert a 10R x 3C table at the very top of the module (above all other objects) and a 5R x 4C table one level below the currently selected object

 

Object o = current
 
Object tableTopMost = table(current Module, 10, 3) 
Object tableOneLevelBelow = table(below(o),5, 4)



You will need to read up on DXL for DOORS tables though - there are many concepts and properties to consider such as hidden table header objects, the addition of table borders, width of columns, cell text alignment and many others. As mentioned in a post above - have a look at the DOORS Help menu, select the "DXL Reference Manual" and look up the section on "Tables" under the Content tab. Be aware that DOORS tables can be difficult to deal with - they are not very flexible\friendly when it comes to modifying structural properties e.g. you cannot copy-n-paste an entire row or column, or cut-n-paste to move a row or column.



 

 

 


Paul Miller
Melbourne, Australia

 

 

Re: Creating Object headings via script
TooDifficult - Tue Jan 11 17:21:15 EST 2011

SystemAdmin - Tue Jan 11 00:21:27 EST 2011

Can this table be inserted via, again, DXL?

Yep, sure can - as an example, something like the following will insert a 10R x 3C table at the very top of the module (above all other objects) and a 5R x 4C table one level below the currently selected object

 

Object o = current
 
Object tableTopMost = table(current Module, 10, 3) 
Object tableOneLevelBelow = table(below(o),5, 4)



You will need to read up on DXL for DOORS tables though - there are many concepts and properties to consider such as hidden table header objects, the addition of table borders, width of columns, cell text alignment and many others. As mentioned in a post above - have a look at the DOORS Help menu, select the "DXL Reference Manual" and look up the section on "Tables" under the Content tab. Be aware that DOORS tables can be difficult to deal with - they are not very flexible\friendly when it comes to modifying structural properties e.g. you cannot copy-n-paste an entire row or column, or cut-n-paste to move a row or column.



 

 

 


Paul Miller
Melbourne, Australia

 

 

Hi Paul,

I've tried out the table functions with some splendid results!

The DXL manual has an example that prints cell identifiers of each cell in the table.

I was wondering whether it's possible to enter text into these cells via DXL, like,

Rev | Date | Changer |Changesmade

Haven't found any in the DXL manual

Thanks!

TooDiff

Re: Creating Object headings via script
TooDifficult - Tue Jan 11 19:07:57 EST 2011

TooDifficult - Tue Jan 11 17:21:15 EST 2011
Hi Paul,

I've tried out the table functions with some splendid results!

The DXL manual has an example that prints cell identifiers of each cell in the table.

I was wondering whether it's possible to enter text into these cells via DXL, like,

Rev | Date | Changer |Changesmade

Haven't found any in the DXL manual

Thanks!

TooDiff

Module m = current
    //insert a table first, based on current revtables seems like best choice is r4 c5
        Object RevTable = table(m,4,5)
 
                //object template
        Template MRDheadings = template "Purpose"     
                                        "Scope"               
                                        "References"  <<
                                        "Reference 1 - add more below"        >>
                                        "Product Purpose" 
                                        "Critical Market Driven Features" 
                                        "Intended use(s)" 
                                        "Patient Group" 
                                        "Target Markets (Geographical, Organisations, etc.)" 
                                        "Timing"      
                                        "Saleable Product Life Span" 
                                        "Competitive positions/devices" 
                                        "Target COGS" 
                                        "Volume Forecasts" 
                                        "Risks" 
                                        "Requirements"
 
        //RevTable = current
        instance below MRDheadings

 


Hi guys,

This is what I've got so far for inserting a table and heading templates. Funny thing is it keeps crashing when I combine the two. I can insert either the table alone or the headings alone but when both scripts come together as above it crashes.

I've considered also the possibility that since DOORS treats a table as an object, it might be trying to enter the template info into the cells, which messes things up. I've tried to remedy this situation by setting RevTable to current object (dont' know whether this is the correct definition) and inserting the instance MRDheadings as instance BELOW MRDheadings.

If I'm not wrong then this will insert the headings underneath the table. But that probably isn't the issue because it's still crashing.

Any ideas?

TooDiff

 

Re: Creating Object headings via script
Mathias Mamsch - Tue Jan 11 20:43:47 EST 2011

TooDifficult - Tue Jan 11 19:07:57 EST 2011

Module m = current
    //insert a table first, based on current revtables seems like best choice is r4 c5
        Object RevTable = table(m,4,5)
 
                //object template
        Template MRDheadings = template "Purpose"     
                                        "Scope"               
                                        "References"  <<
                                        "Reference 1 - add more below"        >>
                                        "Product Purpose" 
                                        "Critical Market Driven Features" 
                                        "Intended use(s)" 
                                        "Patient Group" 
                                        "Target Markets (Geographical, Organisations, etc.)" 
                                        "Timing"      
                                        "Saleable Product Life Span" 
                                        "Competitive positions/devices" 
                                        "Target COGS" 
                                        "Volume Forecasts" 
                                        "Risks" 
                                        "Requirements"
 
        //RevTable = current
        instance below MRDheadings

 


Hi guys,

This is what I've got so far for inserting a table and heading templates. Funny thing is it keeps crashing when I combine the two. I can insert either the table alone or the headings alone but when both scripts come together as above it crashes.

I've considered also the possibility that since DOORS treats a table as an object, it might be trying to enter the template info into the cells, which messes things up. I've tried to remedy this situation by setting RevTable to current object (dont' know whether this is the correct definition) and inserting the instance MRDheadings as instance BELOW MRDheadings.

If I'm not wrong then this will insert the headings underneath the table. But that probably isn't the issue because it's still crashing.

Any ideas?

TooDiff

 

The problem might be, that the instance function will try to create the objects by default after the current object. When you insert the table, the current object is probably the last cell, and creating an object after a cell is a pretty bad idea. So you want to try selecting the table head as current before continuing, maybe like: current = getTable current. Or just try to set the current object to the first object and see if the crash goes away.

Regards, Mathias


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

Re: Creating Object headings via script
TooDifficult - Tue Jan 11 22:14:55 EST 2011

Mathias Mamsch - Tue Jan 11 20:43:47 EST 2011
The problem might be, that the instance function will try to create the objects by default after the current object. When you insert the table, the current object is probably the last cell, and creating an object after a cell is a pretty bad idea. So you want to try selecting the table head as current before continuing, maybe like: current = getTable current. Or just try to set the current object to the first object and see if the crash goes away.

Regards, Mathias


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

Hi, thanks for the reply;

I've tried the current = getTable current, there was no debug error so I guess it was logically correct. But the crash is still there.

With this one, I looked up the DXL Ref Manual and it says that it retrieves the table header. So I guess this method should be able to work.

In regards to the set current to first object, how do I do that? Also, doesn't that mean that I'm setting current to point to the first cell in my case? The code creates the table before putting any headings in. So it should appear before the "1 heading" object. If it's pointing to the first cell then it's trying to create the template in between the first and second cell.

Regardless I'll give it a shot. I'm guessing you're talking about the current = Object object function?

So technically my commented bit with RevTable = current is sort of correct right? Just not syntactically.

To set the object to the first, it's current = first current Module. Does this count the whole table as an object?

Also after doing some debugging I found that after running the code, and letting it crash, by trying to open it again after a Doors.exe restart, it would crash again. So I'm thinking that the template was created already, just that DOORS was having a lot of trouble trying to display it.

I've also tried splitting the function into two, creating the table first then the headings, but to no avail.

I'll try this out and get back to you.

Thanks!

TooDiff

Re: Creating Object headings via script
TooDifficult - Tue Jan 11 22:23:48 EST 2011

TooDifficult - Tue Jan 11 22:14:55 EST 2011
Hi, thanks for the reply;

I've tried the current = getTable current, there was no debug error so I guess it was logically correct. But the crash is still there.

With this one, I looked up the DXL Ref Manual and it says that it retrieves the table header. So I guess this method should be able to work.

In regards to the set current to first object, how do I do that? Also, doesn't that mean that I'm setting current to point to the first cell in my case? The code creates the table before putting any headings in. So it should appear before the "1 heading" object. If it's pointing to the first cell then it's trying to create the template in between the first and second cell.

Regardless I'll give it a shot. I'm guessing you're talking about the current = Object object function?

So technically my commented bit with RevTable = current is sort of correct right? Just not syntactically.

To set the object to the first, it's current = first current Module. Does this count the whole table as an object?

Also after doing some debugging I found that after running the code, and letting it crash, by trying to open it again after a Doors.exe restart, it would crash again. So I'm thinking that the template was created already, just that DOORS was having a lot of trouble trying to display it.

I've also tried splitting the function into two, creating the table first then the headings, but to no avail.

I'll try this out and get back to you.

Thanks!

TooDiff

Argh, current = first current Module didn't work. I think it set the current to the first cell in the table.

instance t creates template t AFTER the current object. This means it should appear as a separate object after the last cell doesn't it? So if I print identifier cell and try to set current to the last cell, and insert template after that last cell, should it work?

Or is it doing the same thing as DOORS itself, since you said the last object after the function has been executed is in fact the last cell.

What's the difference between below and after?

Thanks,

TooDiff

Re: Creating Object headings via script
SystemAdmin - Tue Jan 11 23:29:52 EST 2011

TooDifficult - Tue Jan 11 19:07:57 EST 2011

Module m = current
    //insert a table first, based on current revtables seems like best choice is r4 c5
        Object RevTable = table(m,4,5)
 
                //object template
        Template MRDheadings = template "Purpose"     
                                        "Scope"               
                                        "References"  <<
                                        "Reference 1 - add more below"        >>
                                        "Product Purpose" 
                                        "Critical Market Driven Features" 
                                        "Intended use(s)" 
                                        "Patient Group" 
                                        "Target Markets (Geographical, Organisations, etc.)" 
                                        "Timing"      
                                        "Saleable Product Life Span" 
                                        "Competitive positions/devices" 
                                        "Target COGS" 
                                        "Volume Forecasts" 
                                        "Risks" 
                                        "Requirements"
 
        //RevTable = current
        instance below MRDheadings

 


Hi guys,

This is what I've got so far for inserting a table and heading templates. Funny thing is it keeps crashing when I combine the two. I can insert either the table alone or the headings alone but when both scripts come together as above it crashes.

I've considered also the possibility that since DOORS treats a table as an object, it might be trying to enter the template info into the cells, which messes things up. I've tried to remedy this situation by setting RevTable to current object (dont' know whether this is the correct definition) and inserting the instance MRDheadings as instance BELOW MRDheadings.

If I'm not wrong then this will insert the headings underneath the table. But that probably isn't the issue because it's still crashing.

Any ideas?

TooDiff

 

I see two problems.

Firstly - create your table after the headings have been created, it seems as though it is dependent on there being other objects in existance first - I think I understand why but it's a long story.

Secondly - each heading in the Template function must be defined with one of the level operators - I noticed that in the code example I gave you recently that some level operators are being stripped out by the forums code markup text function - IBM needs to fix that problem. Instead, I have attached a revised version of your code which works for me without error - I've added a couple of headings to demonstrate use of the level operators and put the table creation function last.

When defining the template headings as a top down list, each level operator refers to the level that next heading in the list will be inserted relative to the preceding heading. This is why the last heading in the list does not have a level operator. You'll need to play around with these to get them right - the level operators will allow you to jump more than one level using an integer value instead of successive operators e.g. << 4 <> - this means jump up 4 levels and insert at that level.

Paul Miller

Melbourne, Australia
Attachments

attachment_14570265_InsertHeadingsAndTable.dxl

Re: Creating Object headings via script
TooDifficult - Wed Jan 12 16:50:37 EST 2011

SystemAdmin - Tue Jan 11 23:29:52 EST 2011
I see two problems.

Firstly - create your table after the headings have been created, it seems as though it is dependent on there being other objects in existance first - I think I understand why but it's a long story.

Secondly - each heading in the Template function must be defined with one of the level operators - I noticed that in the code example I gave you recently that some level operators are being stripped out by the forums code markup text function - IBM needs to fix that problem. Instead, I have attached a revised version of your code which works for me without error - I've added a couple of headings to demonstrate use of the level operators and put the table creation function last.

When defining the template headings as a top down list, each level operator refers to the level that next heading in the list will be inserted relative to the preceding heading. This is why the last heading in the list does not have a level operator. You'll need to play around with these to get them right - the level operators will allow you to jump more than one level using an integer value instead of successive operators e.g. << 4 <> - this means jump up 4 levels and insert at that level.


Paul Miller

Melbourne, Australia

Hi Paul,

Thanks for the help! It worked!

What I find funny is that even though you put the table below the instance activation in the code, the table still appears above the first heading. Why is this? I thought that the code would execute from top to bottom...

Thanks a lot for this, it really helps.

Also, is it possible to insert text via script into those table cells? I noticed that in the DXL reference manual there's the print identifier cell function in one of the example codes. When run, it prints the cell's tag, so I am guessing there's a way to use that tag to write information into the cell?

Thanks!

TooDiff

Re: Creating Object headings via script
SystemAdmin - Wed Jan 12 18:30:26 EST 2011

TooDifficult - Wed Jan 12 16:50:37 EST 2011
Hi Paul,

Thanks for the help! It worked!

What I find funny is that even though you put the table below the instance activation in the code, the table still appears above the first heading. Why is this? I thought that the code would execute from top to bottom...

Thanks a lot for this, it really helps.

Also, is it possible to insert text via script into those table cells? I noticed that in the DXL reference manual there's the print identifier cell function in one of the example codes. When run, it prints the cell's tag, so I am guessing there's a way to use that tag to write information into the cell?

Thanks!

TooDiff

What I find funny is that even though you put the table below the instance activation in the code, the table still appears above the first heading. Why is this?

You need to refer to the DXL Reference manual - the DXL "table" function is an overloaded function and has many forms, the one that I used in my example specifically locates the table as the very first object in the module object hierarchy. This concept of a "first object" may seem odd as a DOORS table is essentially a 2 dimensional array of many module objects. "first object" refers to a hidden table header object that represents where the table starts (which can be made to appear when you deselect View > Show > Table cells from the module menu), each row of a table also has a hidden row header object - may seem strange but it's a long story and hard to explain without a diagram - I recommend that you read the DXL Reference manual on tables.


Paul Miller
Melbourne, Australia

Re: Creating Object headings via script
SystemAdmin - Wed Jan 12 19:21:46 EST 2011

TooDifficult - Wed Jan 12 16:50:37 EST 2011
Hi Paul,

Thanks for the help! It worked!

What I find funny is that even though you put the table below the instance activation in the code, the table still appears above the first heading. Why is this? I thought that the code would execute from top to bottom...

Thanks a lot for this, it really helps.

Also, is it possible to insert text via script into those table cells? I noticed that in the DXL reference manual there's the print identifier cell function in one of the example codes. When run, it prints the cell's tag, so I am guessing there's a way to use that tag to write information into the cell?

Thanks!

TooDiff

Also, is it possible to insert text via script into those table cells?

I missed this question in my previous reply - the short answer is yes but I think you're going to have to burrow into the DXL reference manual and learn how to navigate through the object structure of a DOORS table - for example, if you know that table cell r1C1 is where the "Version" column title text should be inserted and so on, then you can make use of the DXL for\do loops associated with tables and step through every object in the table and insert text accordingly.

Here's a simple code snippet to demonstrate use of the for\do loops associated with tables - this snippet prints out a row & column cell reference for every cell in a table. To try it, just create a simple table, make sure one of the table cells is selected and then run the code.

 

Object tableRow
Object tableCell
int rowref=0
int colref=0
 
for tableRow in table current Object do { //For each row in a table
    rowref++
    colref=0 
    for tableCell in row tableRow do { //For each cell in a row
        colref++
        print "r" rowref""  "c" colref""  "\t"
    }
    print "\n"
}

 

 


Paul Miller
Melbourne, Australia

 

Re: Creating Object headings via script
TooDifficult - Wed Jan 12 22:37:46 EST 2011

SystemAdmin - Wed Jan 12 19:21:46 EST 2011

Also, is it possible to insert text via script into those table cells?

I missed this question in my previous reply - the short answer is yes but I think you're going to have to burrow into the DXL reference manual and learn how to navigate through the object structure of a DOORS table - for example, if you know that table cell r1C1 is where the "Version" column title text should be inserted and so on, then you can make use of the DXL for\do loops associated with tables and step through every object in the table and insert text accordingly.

Here's a simple code snippet to demonstrate use of the for\do loops associated with tables - this snippet prints out a row & column cell reference for every cell in a table. To try it, just create a simple table, make sure one of the table cells is selected and then run the code.

 

Object tableRow
Object tableCell
int rowref=0
int colref=0
 
for tableRow in table current Object do { //For each row in a table
    rowref++
    colref=0 
    for tableCell in row tableRow do { //For each cell in a row
        colref++
        print "r" rowref""  "c" colref""  "\t"
    }
    print "\n"
}

 

 


Paul Miller
Melbourne, Australia

 

Hi Paul, thanks for the reply.

I had a look at the reference manual and it doesn't say much in terms of actual manipulation of cells, only the overall manipulation of attributes and the table itself.

If I wanted to limit your loop to just one row, I'd cancel the outer loop and keep the inner loop right? However, because DOORS' starts loops from the first row TableRow, then I would need to tell DOORS which row to manipulate if I removed the outer loop.

Is there a way to mark tableRow, i.e., give it a tag and tell DOORS to deal with that row only?

Also, is inserting text a generic function? Can I treat it like entering textual headings? I ask this because there don't seem to be specific tabular text functions.

From what I understand, there's one overall header object called the table header. Then each row is counted as objects, and cells are then the subdivisions of each of those objects. I THINK I would be able to tackle text editing using the templates?

What do you think?

TooDiff

Re: Creating Object headings via script
TooDifficult - Wed Jan 12 23:18:39 EST 2011

TooDifficult - Wed Jan 12 22:37:46 EST 2011
Hi Paul, thanks for the reply.

I had a look at the reference manual and it doesn't say much in terms of actual manipulation of cells, only the overall manipulation of attributes and the table itself.

If I wanted to limit your loop to just one row, I'd cancel the outer loop and keep the inner loop right? However, because DOORS' starts loops from the first row TableRow, then I would need to tell DOORS which row to manipulate if I removed the outer loop.

Is there a way to mark tableRow, i.e., give it a tag and tell DOORS to deal with that row only?

Also, is inserting text a generic function? Can I treat it like entering textual headings? I ask this because there don't seem to be specific tabular text functions.

From what I understand, there's one overall header object called the table header. Then each row is counted as objects, and cells are then the subdivisions of each of those objects. I THINK I would be able to tackle text editing using the templates?

What do you think?

TooDiff

Hey Paul,

I forgot to ask you; you know how we can define the level of the heading to insert as an integer.

What level is plain text/rich text considered?

Thanks,

TooDiff

Re: Creating Object headings via script
bullbala - Wed Jan 19 03:21:01 EST 2011

TooDifficult - Wed Jan 12 23:18:39 EST 2011
Hey Paul,

I forgot to ask you; you know how we can define the level of the heading to insert as an integer.

What level is plain text/rich text considered?

Thanks,

TooDiff

If I am not wrong, in Paul's latest snippet, the following lines may be inserted as the first one in both the 'for' loops respectively:

if(isDeleted tableRow) continue
if(isDeleted tableCell) continue

I hope this helps ignore deleted rows and columns/cells.