[
https://issues.apache.org/jira/browse/FINERACT-2622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Hysnije updated FINERACT-2622:
------------------------------
Description:
h3. Steps to reproduce
# Navigate to *System* > *Admin* > *Manage Reports*
# Create a report for any entity with an SQL script which contains an
"{*}Order By{*}" statement e.g.
{code:java}
SELECT account_no FROM m_loan ORDER BY account_no DESC{code}
# Navigate to *Reports* and select the newly created report
# Click "{*}Run Report"{*}
h3. Actual result
Loan account numbers are *not* displayed in correct descending numerical order
!image-2026-05-28-14-14-09-703.png!
h3. Expected result
{{Loan account numbers should always be displayed in {*}correct descending
order{*}, respecting the ORDER BY account_no DESC SQL clause.}}
h3. Additional information
The issue is that the SQL is wrapped into a subselect
[https://github.com/apache/fineract/blob/develop/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java#L202.|https://github.com/apache/fineract/blob/develop/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java#L202]
was:
h3. Steps to reproduce
# Navigate to *System* > *Admin* > *Manage Reports*
# Create a report for any entity with an SQL script which contains an
"{*}Order By{*}" statement e.g.
{code:java}
SELECT account_no FROM m_loan ORDER BY account_no DESC{code}
# Navigate to *Reports* and select the newly created report
# Click "{*}Run Report"{*}
h3. Actual result
Loan account numbers are *not* displayed in correct descending numerical order
!image-2026-05-28-14-14-09-703.png!
h3. Expected result
Loan account numbers should always be displayed in {*}correct descending
order{*}, respecting the {{ORDER BY account_no DESC }}SQL clause.
h3. Additional information
The issue is that the SQL is wrapped into a subselect
[https://github.com/apache/fineract/blob/develop/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java#L202.|https://github.com/apache/fineract/blob/develop/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java#L202]
> Values not sorted correctly in report output
> --------------------------------------------
>
> Key: FINERACT-2622
> URL: https://issues.apache.org/jira/browse/FINERACT-2622
> Project: Apache Fineract
> Issue Type: Bug
> Reporter: Hysnije
> Priority: Major
> Attachments: image-2026-05-28-13-41-40-863.png,
> image-2026-05-28-14-14-09-703.png
>
>
> h3. Steps to reproduce
> # Navigate to *System* > *Admin* > *Manage Reports*
> # Create a report for any entity with an SQL script which contains an
> "{*}Order By{*}" statement e.g.
> {code:java}
> SELECT account_no FROM m_loan ORDER BY account_no DESC{code}
> # Navigate to *Reports* and select the newly created report
> # Click "{*}Run Report"{*}
> h3. Actual result
> Loan account numbers are *not* displayed in correct descending numerical order
> !image-2026-05-28-14-14-09-703.png!
> h3. Expected result
> {{Loan account numbers should always be displayed in {*}correct descending
> order{*}, respecting the ORDER BY account_no DESC SQL clause.}}
> h3. Additional information
> The issue is that the SQL is wrapped into a subselect
> [https://github.com/apache/fineract/blob/develop/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java#L202.|https://github.com/apache/fineract/blob/develop/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java#L202]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)