Skip to main content
1-Visitor
February 16, 2019
Question

Get field value of a related Test Document inside a report recipe

  • February 16, 2019
  • 1 reply
  • 1530 views

Hello friends,

     I am trying to create a Custom Recipe in PTC Integrity 10.9 for a report where I need to fetch the field value of a document that is related to the document that has been passed as an input to the report.

 

var fieldvalue1 = <%fieldname1%>;

var fieldvalue2 = <%fieldname2%>;

 

Here, I want the fieldvalue2 to be value of the field "fieldname2"as per the document that I got as "fieldvalue1".

 

I am very new to Integrity custom report creation. Appreciate your help.

 

 

1 reply

5-Regular Member
February 19, 2019

To specify a relationship field rather than the item field, you need to use <%Relationship fieldname2%>, within the <%beginrelationshipdetail relationshipname%> section of the report. 

 

There are some example report recipes using relationships (e.g. Detail - HTML, Row, Relationships). If you create a report using the recipe, then view the report on the CLI using im viewreport reportname, you can see how the field values are defined.  Here's a sample relationship section of a report created from the Detail - HTML, Row, Relationships recipe:

<!-- Relationships info -->

<tr class="odd_row">
 <td colspan="4" class="border">
 <span class="bold_color_underline">Documented By:</span><br>
 <div class="center">
 <table class="list">
 <%beginrelationshipsdetail Documented By%>
	
 <%relationshipsortby ID+%>
 <!-- Display relationship issue field headings -->
 <%beginrelationshipsection header%>
 <tr> 
 <th>ID</th> 
 <th>Type</th> 
 <th>State</th> 
 <th>Document Short Title</th> 
 </tr>
 <%endrelationshipsection%>
 <!-- Display no relationships found -->
 <%beginrelationshipsection none%>
 <tr><td>No related items.</td></tr>
 <%endrelationshipsection%>
 <!-- Display relationship issue field values -->
 <tr> 
  <td><%Relationship ID%></td>  
 <td><%Relationship Type%></td> 
 <td><%Relationship State%></td> 
 <td><%Relationship Document Short Title%></td> 
 </tr>
 <%endrelationshipsdetail%>
 </table>
 </div>
 </td>
</tr>