This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - XSLT report generation and modification

walekarsa - Wednesday, December 30, 2009 1:00 AM:

Hi,

I am trying to make Reports for Item type 'Project'. THis has a relationship item 'Project Docs'. I want to show some property of Item Project and some property of related item 'Deliverable ' in the report.

Following is the query that I had written.

<Item type="Project" action="get" select="project_number,name,state">
 <Relationships>
  <Item type="Project Docs" action="get" select="id">
   <related_id>
    <Item type="Document" action="get" select="name"/>
   </related_id>
  </Item>
 </Relationships>
</Item>

I have also made changes in the style sheet as follows.

<xsl:for-each select="//Item[@type='Project']">
            <tr>
              <td>
                <xsl:value-of select="project_number"></xsl:value-of>
              </td>
              <td>
                <xsl:value-of select="name"></xsl:value-of>
              </td>
              <td>
                <xsl:value-of select="state"></xsl:value-of>
              </td>
              <xsl:for-each select="/Item[@type='Deliverable']/related_id/Item[@type='Project Docs']/Relationships/Item[@type='Project']">           

              <td>
                  <xsl:value-of select="name"></xsl:value-of>
              </td>
            </xsl:for-each>
          </tr>
    </xsl:for-each>

 

The Result Desired is : If the Project has some deliverable attched it should show its name, otherwise the name should be blank.

I am getting the properties of the 'Project Item', but am not able to get the name property of the deliverable.

Please help me in getting the result.

Thanks in Advance,



tstickel - Thursday, December 31, 2009 9:40 AM:

Your query does not return the deliverable documents, instead you must use

<Item type="Project" action="get" select="project_number,name,state">
 <Relationships>
  <Item type="Project Docs" action="get" select="related_id">
    <related_id>
      <Item type="Document" action="get" select="name"/>
    </related_id>
  </Item>
 </Relationships>
</Item>

Note that the only difference between our queries is the select="related_id" instead of select="id".  It is a good idea to test report queries standalone (e.g. via the report definition "Run Query"" or via the Innovator Nash tool, see localhost/.../nash.aspx) to ensure that they retrieve what you are expecting.

In your style sheet, change the line

<xsl:for-each select="/Item[@type='Deliverable']/related_id/Item[@type='Project Docs']/Relationships/Item[@type='Project']">

to

<xsl:for-each select="//Item[@type='Document']">

and Innovator will list the document names that are deliverables for the Project (ie. that are found on the Project's Documents tab)

If you want the report to include the deliverable document names from the Project Activity deliverables it will take a different query and stylesheet.



walekarsa - Wednesday, January 6, 2010 7:16 AM:

Hi Terry,

I wanted to this all the Projects even if they had no Documents attached to them. THis would probably give me only those projects to which the documents were attached.

Anyways I could get the result. by using Match template within a template option.

However If I try to get the Activity Actual Start date using this method I am not able to get it.

I am using the following code.

<Item type="Project" action="get" select="project_number,name,state">
 <Relationships>
  <Item type="WBS Activity2" select="keyed_name,related_id">
   <related_id>
    <Item type="Activity2" select="date_start_act,date_due_act"/>
   </related_id>
  </Item>
 </Relationships>
</Item>
 and in Xslt i am doing these modifications.

<xsl:template match="//Item[@type='Project']">
    <tr valign="top">
      <td uniqueID="ms__id2">
        <xsl:value-of disable-output-escaping="yes" select="project_number"></xsl:value-of>
      </td>
      <td uniqueID="ms__id3">
        <xsl:value-of disable-output-escaping="yes" select="name"></xsl:value-of>
      </td>
      <td uniqueID="ms__id4">
        <xsl:value-of disable-output-escaping="yes" select="state"></xsl:value-of>
      </td>
      <td>
        <xsl:apply-templates select="Relationships/Item[@type='WBS Activity2']"></xsl:apply-templates>
      </td>
      </tr>
</xsl:template>
  <xsl:template match="Relationships/Item[@type='WBS Activity2']">
    <xsl:apply-templates select="related_id/Item[@type='Activity2']"></xsl:apply-templates>
  </xsl:template>
  <xsl:template match="related_id/Item[@type='Activity2']">
    <xsl:value-of select="date_start_act"></xsl:value-of>
    <xsl:value-of select="date_due_act"></xsl:value-of>
  </xsl:template>

 

Can you help me in this regards,