• Resolved r0ss26

    (@r0ss26)


    So I have a field which is stored in the database as a date/year (e.g. 1978). I have modified the list template so that it display the number of years elapsed since that date. e.g. if the database has 1978, when the list is viewed it will show 41. This means that the when sorting by ascending or descending on that field it will show the wrong way around. Would it be possible to reverse the order when sorting by that particular field only?

Viewing 1 replies (of 1 total)
  • Plugin Author xnau webdesign

    (@xnau)

    You can’t sort by a dynamically-assigned value because the sorting is done using the database values. This is why it seems to be reversed. (lower date = higher age) because it’s actually sorting by year, not by age.

    So, if you’ve got some coding skills you can set it up so that the query is altered to change the sort direction only if the year (age) column is the sort column.

    On the Participants Database API page, there are two ways to do this: the ‘pdb-list_query’ filter or the ‘pdb-list_query_object’ action.

Viewing 1 replies (of 1 total)
  • The topic ‘Change the ‘sort by’ behaviour’ is closed to new replies.