Question

Work Queue Sort

  • 9 June 2021
  • 3 replies
  • 154 views

We are trying to sort the work queue based on the Scheduling Code Priority Factor.  The Scheduling code is a text field and sorts like 1, 10, 11, 2, 21, 22.  The Priority factor that is assigned to the scheduling code is a number field and should sort correctly.  Is there any way to get the priority factor on the work queue form to be able to sort?  I tried using the Erp.WorkQueue.GetOpsInResourceGroup BO and set number1 on the ttWorkQueue table to the priority factor based on a query but it didn’t work correctly.  Admittedly this is much more advanced than what I have tried in the past so I am in way over my head!!

 

We are working on Epicor version 10.1.500.

 

Thank you for any help!

Michelle Thompson

Vektek LLC


3 replies

Userlevel 3

If all the values are numeric, you can call Convert (int, column) to convert the value to a number.  Then it would sort the way you want.

Unfortunately not all of the values are numeric. 

 

Userlevel 3

If there’s a mix of numbers and strings, then the best way to sort is to prefix your numbers with “0”s for the number of digits you plan to use.  Ex: instead of “1”, have “001”, instead of “10”, have “010”.  Then it will make the numerics sort properly.

If you can’t go back and change the numerics, then (assuming you’re using a SQL query or BAQ), you could add a calculated “SortBy” column.  If the value is numeric (I think there’s an IsNumeric function), do a format on it so that it is prefixed with 0s, otherwise, output the column.

A really ugly solution if the IsNumeric or padding doesn’t work, would be to do a case statement.  Where value = “1” output “001”, where value = “10”, output “010”.  That would do it too.  It may be ugly and verbose, but it would work.  

Those are the quick answers off the top of my head without trying exact syntax in SQL.

Reply