Bug 7335 - Allow custom parameters for sorting in SQL reports
Summary: Allow custom parameters for sorting in SQL reports
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Galen Charlton
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-08 13:39 UTC by Katrin Fischer
Modified: 2024-03-28 15:17 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2011-12-08 13:39:32 UTC
I was trying to find a solution to make it possible to select how a report is sorted before running it.

Perhaps we could have a table sorter on tables generated by reports? 

I tried using the placeholders to provide a pull down with search options, but this didn't work. The replaced text is always in quotes, so the generated sql will not work:

select concat(surname, ", ", firstname) as Name, cardnumber from borrowers order by 'cardnumber desc'
Comment 1 Cab Vinton 2018-06-06 16:02:25 UTC
This is a bit kludgy, but I believe it works:

Report for patrons w/ emails:

SELECT cardnumber, surname, firstname, email, dateexpiry, dateenrolled
FROM borrowers
WHERE email IS NOT NULL AND email!= ''
ORDER BY CASE WHEN @SortOrder:=<<Search order>> = 'dateexpiry' THEN dateexpiry
              WHEN @SortOrder= 'cardnumber' THEN cardnumber
         END

Official column names have to be used rather than something more user-friendly, but otherwise it's