PDF List sort order [message #2330] |
Mon, 02 November 2009 11:28 |
gpatti
Messages: 283 Registered: August 2008
|
Senior Member |
|
|
Not sure if this is a bug or something I have missed somewhere...
I am producing a simple PDF list report which has a sort order defined in the task. Works normally.
However, if I click the RESET button before clicking the PDF list navigation button (e.g. to clear a previous search criteria before printing) I find that the report is printed in reverse order.
If I go back to the previous parent task and return again the sort order is restored until the next time the RESET button is pressed.
[Using 1.53 but I don't think it is a recent bug. Noticed it a while ago but didn't investigate further at the time]
|
|
|
Re: PDF List sort order [message #2331 is a reply to message #2330] |
Mon, 02 November 2009 16:05 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
It is standard behaviour when a navigation button is pressed for the current sort order in the parent task to be passed down to the child task. This will override any default order setting in the child task. If you want to ignore the passed value and override it with a fixed value you will have to change it with code in the _cm_pre_getData() method.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
Re: PDF List sort order [message #2334 is a reply to message #2330] |
Tue, 03 November 2009 09:00 |
gpatti
Messages: 283 Registered: August 2008
|
Senior Member |
|
|
Sorry, I have made a mistake with the post below. I have posted the ORDER BY from the wrong place. The actual order elements are coming from the parent task as you described, However, the asc / desc problem is documented correctly.
-------------
I've done some tests and I think there is something more going on with this. By logging the SQL queries I can see what ORDER BY statement is being generated:
On initial entry to the list screen the order by clause is being taken from that in the task definition - the ASC is being added by the framework:
ORDER BY branch.branch_id, branch.syllabus_type_id, grade.seq, exam.related_exam_id, exam.related_exam_seq, candidate.last_name, candidate.first_name asc LIMIT 10 OFFSET 0 =>Count=35
When I run the PDF output (a navigation button from the list task) the first time it uses the order defined in the task definition, again with ASC appended by the framework:
ORDER BY exam.branch_id, exam.syllabus_type_id, exam.related_exam_id, exam.related_exam_seq, candidate.last_name, candidate.first_name asc =>Count=35
On clicking RESET, the query generated for the list task is identical to previous as expected. The order for the PDF output task is also the same, except that now the framework has appended DESC to the query instead, thus reversing the order:
ORDER BY exam.branch_id, exam.syllabus_type_id, exam.related_exam_id, exam.related_exam_seq, candidate.last_name, candidate.first_name desc =>Count=35
Something in the RESET operation is causing the sort to change from asc to desc.
[Updated on: Tue, 03 November 2009 09:10] Report message to a moderator
|
|
|
|