sorting results of a Custom SQL report

Monday, October 28, 2019
Avatar

Hello,

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?

Thanks!

1 Replies
Tuesday, October 29, 2019
Avatar
re: shurix Monday, October 28, 2019

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:

select
    (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)

 

Statistics
  • Started: Monday, October 28, 2019
  • Last Reply: Tuesday, October 29, 2019
  • Replies: 1
  • Views: 1603