Overview
A lot of the times I’m asked if it’s possible to export the embedded tables from the DNG artifacts and to add them in the ToT (Table of Tables) section in WORD. My answer is always YES, it’s possible. RPE as a standalone tool or RRDG used in the DNG context can export DNG tables and add them in the ToT in the generated document.
How can we do this? We have multiple options and I’ll try to cover 2 of them and highlight the pros and cons for each of them.
App Versions Used:
- DNG version: 6.0.6.1
- RPE/RRDG version: 6.0.6.1
Info: In scenarios we will be working with modules from one of the DOORS default templates - Automated Meter Reader, but the examples are not content-specific and you can use any modules to follow the scenarios analogously.
Option 1: Using the Table Caption property on DNG tables
The most preferred database for IBM Jazz Platform is IBM DB2. DB2 is packaged for free and you can find this information.
DNG - Set table caption
In DNG (DOORS Next Generation) we have the possibility to define the table caption for each embedded table. To do that you need to select the table and use right-click to open Table properties
1.) Table properties
In the Table dialog, choose the Advanced tab to define the table caption property. You can see in there that the table caption is a static text and cannot be linked to any other artifact.
2.) Advanced table properties
After adding the caption the table will look like this (in DNG the table caption will be always added on top of the table):
3.) Table caption listed above the table
Tip: To have the table caption centered you’ll have to set the table alignment to be centered in the DNG Table configuration. By default, the left alignment is used;
RPE - Using ToT element
Ok, so we saw what needs to be done in DNG for defining the table caption. Now let’s switch to RPE.
Here, the solution is as easy as in DNG. All we need to do is to use the DNG Text schema to export the tables from DNG and to use a ToT RPE element to build the Table of tables in our WORD document. The DNG tables will be automatically added to the Table of Tables without any other extra effort.
Export DNG tables - RPE snippet
Using the DNG Text schema you’ll be able to export the DNG artifact content as XHTML. This will ensure that all artifact data content plus formatting will be exported in the generated WORD document.
Note: In order to get the xhtml format from DNG you need to use the dataSource->artifact->content->text->richTextBody query on a container and to display the div element inside a paragraph - so simple (see images below)
4.) RPE snippet - export artifact content
When RPE/RRDG is using the reportable API to get the data the DNG table - XHTML content - will look like this (see table caption element highlighted below):
<table border="1" cellpadding="1" cellspacing="1" dir="ltr" id="_1594580295536" style="border-collapse:collapse; border-color:#696969;height:43px;overflow-wrap:break-word;table-layout:fixed;width:16cm;" width="900"> <caption style="text-align: center;">Document History Table</caption><tbody><tr><td colspan="1" id="_1587126630402" rowspan="1" style="background-color:#d3d3d3; overflow:hidden; padding:1px; text-align:center; width:1.93cm"><b><span style="background-color:#d3d3d3">Version</span> </b></td><td colspan="1" id="_1587126630403" rowspan="1" style="background-color:#d3d3d3; overflow:hidden; padding:1px; text-align:center; width:2.75cm"><b><span style="background-color:#d3d3d3">Date</span></b></td><td colspan="1" id="_1587126630404" rowspan="1" style="background-color:#d3d3d3; overflow:hidden; padding:1px; text-align:center; width:2.75cm"><b><span style="background-color:#d3d3d3">Name</span></b></td><td colspan="1" id="_1587126630405" rowspan="1" style="background-color:#d3d3d3; overflow:hidden; padding:1px; text-align:center; width:8.57cm"><b><span style="background-color:#d3d3d3">Change</span></b></td> </tr><tr><td colspan="1" id="_1587126630406" rowspan="1" style="border-color:#696969; overflow:hidden; padding:1px; width:1.93cm">1.0</td><td colspan="1" id="_1587126630407" rowspan="1" style="border-color:#696969; overflow:hidden; padding:1px; width:2.75cm">12/12/2020</td><td colspan="1" id="_1587126630408" rowspan="1" style="border-color:#696969; overflow:hidden; padding:1px; width:2.75cm">SME</td><td colspan="1" id="_1587126630409" rowspan="1" style="border-color:#696969; overflow:hidden; padding:1px; width:8.57cm">Version 1</td></tr></tbody></table>
If you are running the report now, you’ll see the DNG table exported and below the table the caption listed:
5.) Word snippet - table caption listed below the table
Adding the ToT element
Now you have the tables with captions exported from DNG, all you need to do is to insert an empty paragraph in the template (in the position where you want to inject the Table of Tables section) and to drag the Table of Tables element from the RPE Palette-> another group.
If you want to have a label/title for your ToT structure you need to add a paragraph before the ToT paragraph and to display a static text - e.g.: Table of tables
6.) Add ToT element in RPE
If you run the report you’ll see that all tables exported from DNG will be listed in the Table of Tables section. By default, you’ll always have the table number first followed by the caption label and on the right side the page number where the table is displayed.
7.) Generated ToT section in Word
Note: This format is configurable and can be changed if you go to ToT properties in RPE and select the Specific tab -> TOC code property.
Option 1 - Pro & Cons
Now, in the end, let’s see as a summary the pro/cons of this solution:
Pro:
- Easy to implement
- Out of the box functionality in DNG to set table caption
Cons:
- There is no possibility to change the style of the table caption. The caption will be always listed below the table (even in the DNG will be placed above the table) and left align;
- There is no possibility to change the look of the table caption. It’s a fix format: {table number} {table caption}
- There is no way to add dynamic content in the table caption (only static text added in the DNG Table caption will be listed)
Option 2: Defining a custom artifact type in DMG for Table Caption
In case you want to have full flexibility on building/formatting the table caption you’ll have to choose Option 2 where you have a special artifact defined in DNG to store the table caption. This artifact can be added in the DNG module before or after the table, depending on how you want to be positioned in the generated Word document (full flexibility)
Create custom artifact type for storing the table caption - Table caption
All you need to do is to define a new artifact type similar to a regular paragraph/text artifact. Set the type name to be: Table Caption
Insert the Table caption artifact in the DNG module
Based on document formatting requirements this artifact will be placed before/after the artifact that contains the table in DNG (see image below)
8.) Table caption artifact added below the table
As you can see in the artifact properties panel, the type of artifact is Table Caption. This property will be used later on in the RPE snippet to determine what artifacts are going to be displayed as table captions in our final Word document.
9.) Table caption artifact
RPE Snippet - Export DNG table with table caption attached
Now we have in our DNG module 2 different artifacts: one to store the table and another one to store the table caption info. Even though there is extra information added in the DNG module for the table caption, we have more flexibility now to process that information in RPE.
To display the table we are using the same RPE snippet built for Option 1 (link to snippet). Because the table caption is not defined this time in the DNG table, the table will be exported without a caption below.
10.) DNG table exported without the caption
To display the table, the caption will have to build a condition to check that the artifact type is Table Caption and to use a special RPE element called - Table Caption to display the caption below/above the table in Word.
We need to use a Container element in RPE and to build a condition to check that the artifact type == Table Caption (see RPE snippet below). If the condition is met we insert a Table Caption element (found in Palette->Other->Table Caption) and display in the caption the title of the artifact.
Build the RPE condition:
11.) Filter artifacts of type 'Table Caption'
Add the Table Caption element:
12.) RPE snippet
If we are running our report now, we’ll see that the table caption is listed below the table
13.) Table caption listed below the table in Word document
Because the Table Caption is fully configurable now (is an element inside the RPE template) we can adjust the caption label as needed. We can also define the formatting for the table caption and specify the alignment
As an example, we’ll add a static Table text before the caption and we’ll choose a font size=10 and italic to display the table caption
14.) Customize table caption (RPE snippet)
Now if we are running the report again, the table will look like this:
15.) Customized table caption
Adding the ToT element
The process is the same as for Option 1. Just place a Table of Tables element in the position where you want to insert this section in the document.
In this Scenario 2 the ToT section will look like this:
16.) Final Table of Tables section in Word
Option 2 - Pro & Cons
Now, in the end, let’s see as a summary the pro/cons of this solution:
Pro:
- Fully flexible solution
- In terms of caption position, WYS in DNG is WYG in the generated document
- You have the possibility to customize the caption label (using static text or javascript conditions)
- You have the possibility to format the caption (add style information/alignment, etc.)
- You have the possibility to insert dynamic content in the caption from different DNG artifacts
Cons:
- Higher complexity and effort in defining table caption content in DNG (new artifact type needs to be defined)
- Higher complexity in implementing the table caption in RPE
Softacus Services
We, in Softacus, are experts when it comes to consulting and service delivery of IBM software products and solutions in your business. We help our clients to improve visibility and transparency when licensing and managing commercial software, providing measurable value while increasing efficiency and accountability and we are providing services in different areas (see Softacus Services).
IBM ELM extensions developed by Softacus are free of charge for the customers who ordered IBM ELM licenses via Softacus or for the customers who ordered any of our services. If you are interested in any of our IBM ELM extensions, you found a bug or you have any enhancement request, please let us know at info@softacus.com.
Related and Referenced Topics
Blog Articles:
Basics of Links and Link Types in IBM DOORS Next Generation - learn the basics about the linking and link types in IBM DOORS Next.
Linking Techniques in IBM DOORS Next - article explaining basic concepts and showing multiple ways of creation of links between artifacts.
Link By Attribute Feature in IBM DOORS Next - the article explains how to use the "Link by attribute" function to automatically create, update, or delete one or more links between artifacts based on values in the attributes of the artifact.
Softacus Widgets:
Link Switcher - widget developed by Softacus, that converts the context of artifacts links in a very short time.
Module Link Statistics - extension that provides users with a quick overview of the amount of the links in specific link types in a module.
Link Type Change- extension developed by Softacus designed to enhance the functionality of DOORS Next Generation by allowing users to manipulate the direction of a link or convert it to another type of link.
Links Builder- extension that allows the users to create a link between two artifacts in DOORS Next Generation according to the certain rules.
Link by Foreign Attribute - this extension allows users to create links between artifacts in the selected module(s), based on the attributes values.
Show Attributes of Linked Artifacts - this extension shows the attributes and links of the artifact that is currently selected.