As if right now, all rows in the Projects database are sorted by completion date (ascending). Since the non-completed projects have a completion time of 0, they show up at the top of the list. However, there is no way to perform a multi-sort.
How I would like it set up is:
- Have all completed projects at the bottom and sort them by completion date (descending).
- Have all non-completed projects at the top and sort them by start date (descending).
Here's an example:
-- Project #5 (start date 9-1-18) -- Project #3 (start date 8-25-18) -- Project #1 (completion date 9-1-18) -- Project #4 (completion date 8-15-18) -- Project #2 (completion date 6-25-18)
This is how I want everything sorted and ordered.
I spent a couple hours the other day going through the IPS 4 CMS system files (PHP) and I couldn't find any function to allow multi-sort. I tried using the default PHP function:
array_multisort(array_column($rows->container->_data, "project_cd"), SORT_ASC, array_column($rows->container->_data, "project_sd"), SORT_DESC, $rows);
However, the container object is protected. This means I can't modify the _data array directly from outside the IPS 4 class. Instead, I'd have to use other functions within the class to do so and unfortunately, IPS 4 didn't include any functions for additional sorting and ordering.
I will continue to investigate this.
Edited by Roy