cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Customized conditional reports

mbecker-2
1-Newbie

Customized conditional reports

I'm currently trying to loop with a customized HTML report through my document and format the elements depending on their category.

I start with a query and loop through the hierarchy with relationshipsdetail (displayed only until Level 2 below). What I need is the red
part of the report, i.e. how to differentiate between the elements once I found one. If I put the field[Category] within the filter, sorting by
section does not properly work.

This is how it looks like:

<%beginrelationshipsdetail Query[ ( (item.segment) and ( (field[ID] = <%<%builtin ID%>%>) or (walk[<%builtin Contained By%>] <%<%builtin ID%>%>) ) ) ]%>

<!-- we are the top segment -->

<%beginrelationshipsdetailL2 <%builtin References%>.Always follow, <%builtin Contains%>%><%filter%>((item is segment) or (item is node))<%endfilter%>

if (field[Category] = "Comment")

//do something

if (field[Category] = "Architectural Element")

//do something

if (field[Category] = "Heading")

//do something

<%endrelationshipsdetailL2%>

<%endrelationshipsdetail%>

I'd appreciate if anyone would share an idea how to distinguish the different elements.

- Markus

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

I finally found a solution that uses queries and filters based on the Contains and References relationships. As it uses information from the shared item, sorting by section can be used. The solutions looks like

<%beginrelationshipsdetailL2 <%builtin References%>.Always follow, <%builtin Contains%>%><%filter%>(((item is segment) or (item is node)))<%endfilter%>

<%beginrelationshipsdetailL3 <%builtin References%>%><%filter%>((item is shareditem) and (field[Shared Category] == "Heading"))<%endfilter%>

<%RelationshipL2 Summary%>

<%RelationshipL2 ALM_Text%>

<%endrelationshipsdetailL3%>

<%beginrelationshipsdetailL3 <%builtin References%>%><%filter%>((item is shareditem) and (field[Shared Category] == "Comment"))<%endfilter%>

<%RelationshipL2 Summary%>

<%RelationshipL2 ALM_Text%>

<%endrelationshipsdetailL3%>

<%beginrelationshipsdetailL3 <%builtin References%>%><%filter%>((item is shareditem) and (field[Shared Category] == "Architectural Element"))<%endfilter%>

<%RelationshipL2 ID%>: <%RelationshipL2 Summary%>

<%RelationshipL2 ALM_Text%>

<%endrelationshipsdetailL3%>

View solution in original post

2 REPLIES 2
mrump
14-Alexandrite
(To:mbecker-2)

Hi Marcus,

I assume you are planning to create a Document content report that uses differnt formats for the different types of content-categories.

I had the same idea some years ago. Unfortunately there is no "straight" solution for that .

The problem is, that the Integrity report generator does not support any conditional structures apart from filters. But if you use several filters, you will loose the correct "sequence" of items.

Nevertheless, there is hope, meaning 2 possible solution to reach your intendet report.

A: use javascript to "reformat" your content in the browser, after the actual report generation (this works to some extend, but is limited in formating options and the performance is bad on large documents)

B: create a xml report instead of a html and let the XSL transformation handle the different category separartely.

e.g.

the report looks like

...

<REPORT>
<ISSUES>
<%beginrelationshipsdetail Query[ ( (item.segment) and ( (field[ID] = <%<%builtin ID%>%>) or (walk[<%builtin Contained By%>] <%<%builtin ID%>%>) ) ) ]%>

<ISSUE>
<LEVEL>0</LEVEL>
<TYPE><%Relationship <%builtin Type%>%></TYPE>
<CATEGORY><%Relationship <%builtin Shared Category%>%></CATEGORY>
<RQ_TEXT><![CDATA[<%Relationship RQ_Text%>]]></RQ_TEXT>
</ISSUE>
<%beginrelationshipsdetailL2 <%builtin References%>.Always follow, <%builtin Contains%>%><%filter%>(((item is segment) or (item is node)))<%endfilter%>

<ISSUE>
<LEVEL>1</LEVEL>
<TYPE><%RelationshipL2 <%builtin Type%>%></TYPE>

<CATEGORY><%RelationshipL2 <%builtin Shared Category%>%></CATEGORY>

<RQ_TEXT><![CDATA[<%RelationshipL2 RQ_Text%>]]></RQ_TEXT>

</ISSUE>

.....

and you have a XSLT that looks somehow like this

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
</head>
<body>
<xsl:apply-templates select="report/ISSUES"/>
</body>
</html>
</xsl:template>

<xsl:template match="ISSUES">
<hr/>
<xsl:for-each select="//ISSUE[TYPE='Input'] | //ISSUE[TYPE='Requirment'] | //ISSUE[TYPE='Specification'] | //ISSUE[TYPE='Testcase']">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>

<xsl:template match="ISSUE">
<script type="text/javascript">
level=<xsl:value-of select="./LEVEL"/>;
</script>
<table width="100%">
<tbody>
<tr>
<td width="100%">
<?c -------------choose the way of presentation by the Category of Item ------------------ ?>
<xsl:choose>
<?c -------------A Subdocument is treated like a heading ------------------ ?>
<xsl:when test="CATEGORY='Document' or CATEGORY= 'Heading'">
<?c check the argument that controlls the visibility of Headings?>
<xsl:call-template name="Heading_Issue"/>
</xsl:when>
<?c -------------Comment (just plain Text) ------------------ ?>
<xsl:when test="CATEGORY= 'Comment'">
<xsl:call-template name="Comment_Issue"/>
</xsl:when>
<?c ------------- All other categories selective by item type ------------------ ?>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="TYPE = 'Input'">
<xsl:call-template name="Input_Issue"/>
</xsl:when>
<xsl:when test="TYPE = 'Requirement'">
<xsl:call-template name="Requirement_Issue"/>
</xsl:when>
<xsl:when test="TYPE = 'Specification'">
<xsl:call-template name="Specification_Issue"/>
</xsl:when>
<xsl:when test="TYPE = 'Testcase'">
<xsl:call-template name="Testcase_Issue"/>
</xsl:when>
<xsl:otherwise>
<hr/>
<xsl:value-of select='TYPE'/>
<xsl:call-template name="Comment_Issue"/>
<hr/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</tbody>
</table>
</xsl:template>

<?c -------------Template per Item, selectiv ------------------ ?>
<xsl:template name="Heading_Issue">
<table width="100%">
<tbody>
<tr>
<td width="15%">
<b><script type="text/javascript">writeSection();</script></b>
&#32;
<xsl:apply-templates select="./CATEGORY"/>
</td>
<td width="60%">
<xsl:apply-templates select="RQ_TEXT"/>
</td>
</tr>
</tbody>
</table>
</xsl:template>
<xsl:template name="Comment_Issue">
<table width="100%">
<tbody>
<tr>
<td width="15%">
<b><script type="text/javascript">writeSection();</script></b>
&#32;
<xsl:apply-templates select="./CATEGORY"/>
</td>
</tr>
</tbody>
</table>
<span>
<xsl:apply-templates select="RQ_TEXT"/>
</span>
</xsl:template>

....

</xsl:stylesheet>

Hi,

I finally found a solution that uses queries and filters based on the Contains and References relationships. As it uses information from the shared item, sorting by section can be used. The solutions looks like

<%beginrelationshipsdetailL2 <%builtin References%>.Always follow, <%builtin Contains%>%><%filter%>(((item is segment) or (item is node)))<%endfilter%>

<%beginrelationshipsdetailL3 <%builtin References%>%><%filter%>((item is shareditem) and (field[Shared Category] == "Heading"))<%endfilter%>

<%RelationshipL2 Summary%>

<%RelationshipL2 ALM_Text%>

<%endrelationshipsdetailL3%>

<%beginrelationshipsdetailL3 <%builtin References%>%><%filter%>((item is shareditem) and (field[Shared Category] == "Comment"))<%endfilter%>

<%RelationshipL2 Summary%>

<%RelationshipL2 ALM_Text%>

<%endrelationshipsdetailL3%>

<%beginrelationshipsdetailL3 <%builtin References%>%><%filter%>((item is shareditem) and (field[Shared Category] == "Architectural Element"))<%endfilter%>

<%RelationshipL2 ID%>: <%RelationshipL2 Summary%>

<%RelationshipL2 ALM_Text%>

<%endrelationshipsdetailL3%>

Top Tags