Skip Navigation LinksHome Page > Forums > SpiraTeam Forums > Spira Custom Reports > sorting results of a Cust...
I'm trying to re-sort the results that I get from the SQL query.
My query joins Test Cases with Test Steps and Requirements. It seems to be sorting using record IDs by default.
However, my Test Steps are out-of-sequence, so Test Step 6 has a higher TEST_STEP_ID than Test Step 5 and these show-up in the report in the same default sequence.
I added a new SORTBY column into my SQL hoping that <xsl:sort /> would work but it doesn't
<xsl:for-each select="ROW"> <xsl:sort data-type="number" select="SORTBY"/>
Is there another way to custom-sort my results since ORDER BY does not work in ESQL?
You can sort using Entity SQL, however you cannot sort by the ALIAS in the SELECT clause, you have to do it by the actual property names.
I.e. if you have:
(TC.TEST_CASE_ID + TS.POSITION) as SORTBY,
You cannot use:
order by SORTBY
You have to use:
order by (TC.TEST_CASE_ID + TS.POSITION)