Custom Report

In this sample report, we want to find all the tasks that have a start date after their end date.

Using the custom report editor, create a new Excel format report and use the following  Entity SQL query in a custom section:

select '[TK:' + cast (TK.TASK_ID as string) + ']' as TASK_ID, TK.NAME
from SpiraTestEntities.R_Tasks as TK
where TK.PROJECT_ID = ${ProjectId}
and TK.START_DATE > TK.END_DATE

Then use the following XSLT template (or just click the button to auto-generate one):

<?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="/RESULTS">
    <table class="DataGrid"><tr><th>Task ID</th><th>Name</th></tr>
      <xsl:for-each select="ROW">
        <tr><td><xsl:value-of select="TASK_ID"/></td><td><xsl:value-of select="NAME"/></td>
        </tr>
      </xsl:for-each>
        </table>
    </xsl:template>
</xsl:stylesheet>

Now you can run your report

Sample Output

You will see output similar to the following if you choose HTML format:

and the same report in Excel format would look like: