DPL talk:Manual - DPL parameters: Controlling output order

From FollowTheScore
Jump to: navigation, search

Sorting by included text

Would it be possible to sort the output by text included from the results pages? For example, if I have a list of African countries with their populations, I might want to sort by population. – Jonathan Kovaciny 20:08, 19 December 2007 (CET)


There is no a-priori sort in DPL so far but you can offer the result in a sortable table so that the user only needs to click once to have the result sorted according to his preferences. Maybe a javascript-one-liner could do that after the document has been loaded. Depending on the security restrictions in your wiki the execution of javascript may or may not be possible. - Gero 09:15, 22 December 2007 (CET)


+1 vote for this feature... the sortable table is a viable work-around in some cases, but if you want the field to be hidden then it is not an option. For example, I'm using this extension to generate a list of users and their job title in a particular team. At the moment the results are sorted alphabetically - I'd like to assign a 'weight' to each user so that the list is sorted by their position in the company hierarchy. -- Dave 09:50, 22 April 2008 (CEST)

Reply

Currently I do not have time for such a new feature although I see that it would be useful. If you add this functionality to the code I will test it, make it part of he next official release and provide the documentation. This procedure has worked fine with some other contributors in the last months ... How do you feel about it? BTW: The sorting would have to happen in memory AFTER the contents of the columns has been prepared, I guess. Maybe you could prepare a sortkey column while analysing each record (a reason for this is that you probably do not want formatting information in the sortkey column to influence your sort order ..) DPL processes the SQL statement completely before it starts to prepare output - so you will find some structures in the source code which are suitable as a starting point. Gero 10:19, 22 April 2008 (CEST)