Help with Custom Reports - Percentage Calculation

Friday, December 11, 2015
Avatar
I am trying to get percent calculations to appear in excel when generating the test set summary report.  I followed the coding provided by the infectra documentation, but it didn't generate correctly...I'm attaching the report that generated!
So, how would I get the percentages to show up and not be NaN%





I used this code:

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">

  <xsl:template match="/TestSetData">

    <table class="DataGrid" style="width:100%">

      <tr>

        <th>Test Set #</th>

        <th>Name</th>

        <th>Description</th>

        <th>Status</th>

        <th>Release</th>

        <th>Creator</th>

        <th>Owner</th>

     

     

        <th># Passed</th>

        <th># Failed</th>

        <th># Caution</th>

        <th># Blocked</th>

        <th># Not Run</th>

  <th>% Passed</th>

 <th>% Failed</th>

 

        <xsl:for-each select="TestSet[1]/CustomProperties/CustomProperty">

          <th>

            <xsl:value-of select="Alias"/>

          </th>

        </xsl:for-each>

      </tr>

      <xsl:for-each select="TestSet">

        <tr>

          <td>

            TX<xsl:value-of select="TestSetId"/>

          </td>

          <td>

            <xsl:attribute name="style">

              padding-left: <xsl:value-of select="string-length(IndentLevel)*2"/>px;

            </xsl:attribute>

            <xsl:if test="FolderYn='Y'">

              <b>

                <xsl:value-of select="Name"/>

              </b>

            </xsl:if>

            <xsl:if test="FolderYn='N'">

              <xsl:value-of select="Name"/>

            </xsl:if>

          </td>

          <td>

            <xsl:value-of select="Description" disable-output-escaping="yes"/>

          </td>

          <td>

            <xsl:value-of select="TestSetStatusName"/>

          </td>

          <td>

            <xsl:value-of select="ReleaseVersionNumber"/>

          </td>

          <td>

            <xsl:value-of select="CreatorName"/>

          </td>

          <td>

            <xsl:value-of select="OwnerName"/>

          </td>

        

         

         

        

         

          <td>

            <xsl:value-of select="CountPassed"/>

          </td>

          <td>

            <xsl:value-of select="CountFailed"/>

          </td>

          <td>

            <xsl:value-of select="CountCaution"/>

          </td>

          <td>

            <xsl:value-of select="CountBlocked"/>

          </td>

          <td>

            <xsl:value-of select="CountNotRun"/>

          </td>

    <td>

 <xsl:value-of select="FolderCountPassed div (FolderCountPassed + FolderCountFailed + FolderCountCaution + FolderCountNotRun + FolderCountBlocked) * 100" />%

 </td>

<td>

   <xsl:value-of select="FolderCountFailed div (FolderCountPassed + FolderCountFailed + FolderCountCaution + FolderCountNotRun + FolderCountBlocked) * 100" />%

   </td>

 

          <xsl:for-each select="CustomProperties/CustomProperty">

            <td>

              <xsl:value-of select="Value"/>

            </td>

          </xsl:for-each>

        </tr>

      </xsl:for-each>

    </table>

  </xsl:template>

</xsl:stylesheet>


1 Replies
Wednesday, December 23, 2015
Avatar
inflectra.sarahx
re: natashab Friday, December 11, 2015
Hi Natasha

The problem is that your field names are not correct, "FolderCountPassed" is for the test case list, this is the test set page so it would be just:

<xsl:value-of select="CountPassed div (CountPassed + CountFailed + CountCaution + CountNotRun + CountBlocked) * 100" />%

and

<xsl:value-of select="CountPassed div (CountPassed + CountFailed + CountCaution + CountNotRun + CountBlocked) * 100" />%

Regards

Sarah

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Friday, December 11, 2015
  • Last Reply: Wednesday, December 23, 2015
  • Replies: 1
  • Views: 2181