Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » PDF List sort order
PDF List sort order [message #2330] Mon, 02 November 2009 11:28 Go to next message
gpatti is currently offline  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 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2371
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.

Re: PDF List sort order [message #2332 is a reply to message #2330] Mon, 02 November 2009 18:10 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
What is the significance of the RESET button in this?

It looks as though the default sort order in the child task (PDF output) is being used and not the sort order of the parent task, unless the RESET button has been pressed.
Re: PDF List sort order [message #2333 is a reply to message #2332] Tue, 03 November 2009 04:13 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2371
Registered: April 2006
Location: Surrey, UK
Senior Member
The RESET button, when used in the parent task, will reset the sort order to its default value. If this is blank then there is nothing to override the default sort order in the child task.

Re: PDF List sort order [message #2334 is a reply to message #2330] Tue, 03 November 2009 09:00 Go to previous messageGo to next message
gpatti is currently offline  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

Re: PDF List sort order [message #2335 is a reply to message #2334] Tue, 03 November 2009 11:37 Go to previous message
AJM is currently offline  AJM
Messages: 2371
Registered: April 2006
Location: Surrey, UK
Senior Member
I've spotted the bug. The setDefaultOrderBy() method was setting the default sort sequence to 'asc', then the setOrderBy() function was then switching it from 'asc' to 'desc'. Try the attached file to if it fixes your problem.

Previous Topic: Maximum Query Execution Time
Next Topic: Export Templated Task
Goto Forum:
  


Current Time: Thu Nov 28 21:17:47 EST 2024

Total time taken to generate the page: 0.01095 seconds