1

When I run a Civicase report and request it to be sorted by 'Status' the sort order comes out according to the id of the status record (ORDER BY case_civireport.status_id). Whereas I have updated the 'order' field on the case status admin and believe the report should use that 'order', not the row id.

Can anyone confirm this? Might it be classed a bug?

I have tried it on https://dmaster.demo.civicrm.org and can confirm that changing the order in Administer->CiviCase->Case Statuses has no effect on the report ordering.

Thanks.

  • Hi @Demerit. Yes, I looked at changing the status_id on the admin screen, but your are right, I am told it will result in de-linking anything that already has the status id recorded against it. I was hoping the weight would be used as the sort order in reporting too, since we have around 500 cases live, I don't really want to mess with the database directly as a work-round. It feels odd to provide a sorting function that will break the data if it's used to edit the order in which data is presented. Maybe I need to submit a request for an option to use weight instead of value in the report. – Oddjob Feb 20 at 15:08
  • It doesn't seem unreasonable. I think for Case Summary for example it would mostly involve adding a join on civicrm_option_value to get the weight, and then maybe overriding the orderBy() function. You could also do this in a local customization of CRM/Report/Form/Case/Summary.php in an extension. – Demerit Feb 20 at 16:28
1

There is a "weight" field and a "value" field for each status. Changing the ordering on the admin pages changes the weight. Changing the "value" will correspond to status_id, but be careful about that - I'm not sure if it will autoupdate your existing data, i.e. if the value of "Completed" is "2" and you change it to "7", you might still have data in the system that has "2" stored and so it won't represent Completed anymore. You would then need to update civicrm_case.status_id in the database to match. Make a backup first if you're going to try that!

Weight is used for ordering in dropdown lists and such.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.