Answers.Body: <p>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 <strong>value</strong> 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!</p>
  
  <p>Weight is used for ordering in dropdown lists and such.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-19T15:29:36.663Z
Answers.LastActivityDate: 2019-02-19T15:29:36.663Z
Answers.UserDisplayName: Demerit
Body: <p>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.</p>
  
  <p>Can anyone confirm this? Might it be classed a bug?</p>
  
  <p>I have tried it on <a href="https://dmaster.demo.civicrm.org" rel="nofollow noreferrer">https://dmaster.demo.civicrm.org</a> and can confirm that changing the order in Administer->CiviCase->Case Statuses has no effect on the report ordering.</p>
  
  <p>Thanks.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-20T15:08:38.890Z
Comments.Text: 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.
Comments.UserDisplayName: Oddjob
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-20T16:28:44.207Z
Comments.Text: 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.
Comments.UserDisplayName: Demerit
Tags: <civicase>
Title: In Civicase - reports ignore 'Order' on 'Status' and use status id instead?
ThreadText: # In Civicase - reports ignore 'Order' on 'Status' and use status id instead?
  
  (Asked by: username_0 on 2019-02-19)
  
  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.
  
  **Tags:** civicase
  
  > **Comments:**
  > **username_0**: Hi @username_1. 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.  
  > **username_1**: 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-19. Score: 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.
  
  
  ---
  
  