One frequently requested feature in Work Manager is for the ability to allow the user to sort the list of Work Orders displayed on their device.  In Work Manager the list of work orders is displayed using a Tile List control.  In this post, I will show you the steps necessary to add user sorting to the main list of Work Orders.  This procedure is based on the Work Manager 6.3.1 product but can also be applied to other versions.


For this scenario, I want to add sorting on the following Work Order properties.

  • WO Num
  • Priority
  • Type
  • Due Date

The end result will be the new sort toolbar button that the user can select to choose which of these properties the work order list will be sorted by.  The screen shot below shows the final result in the WPF client but it also works in iOS and Android.

/wp-content/uploads/2016/08/final_1009337.png




Adding user sorting to the work orders tile list


To make this work we will need a new property in the underlying collection object.  For Work Manager, this is the WorkOrder object.  We will add a new String property to the WorkOrder object.


/wp-content/uploads/2016/08/1objprop_1009216.png


Next we need to add a transaction to the WorkOrder object to update the new CurrentSort property. Repeat the following steps for each of the properties that the user can select (WO Num, Priority, Type, Due Date).

Create Transaction to Update CurrentSort

  1. Select the WorkOrder Object, Transactions Properties List and Add a new Edit Transaction
    /wp-content/uploads/2016/08/2addtransaction_1009244.png
  2. By default all object properties are Selected.  Click the Remove All button to remove all the selected properties
  3. Add the WONum (Key Property) to the Selected Properties
  4. Add the CurrentSort property to the Selected Properties
  5. Click Finish to be taken to the New Transaction properties
  6. Set the Name and Display Name properties and Save your changes.
    /wp-content/uploads/2016/08/3transprop_1009245.png
  7. Select the Transaction properties tab and double click on Current Sort to view the properties
  8. Set the Initial Value for the CurrentSort property to From a different object property
  9. Set the Other Property to the field you want to sort on (:> “WONum” Property)
    /wp-content/uploads/2016/08/4transcurrentsortprop_1009246.png

Now that we have the transactions defined, we need to create actions to run those transactions.  Again, repeat the following steps for each of the transactions that were just created (SortOnWONum, SortOnPriority, SortOnType, SortOnDueDate).


Create Action to run the Transaction


  1. Create a new action and set the Name, Group and For Obejct
    /wp-content/uploads/2016/08/5createactionxact_1009288.png
  2. Select the Action Steps properties tab
  3. Add a Transaction Action Step and point to the Transaction previously created
    /wp-content/uploads/2016/08/6xactactionstep_1009289.png
  4. Add an Apply Action Step


Next we need to create a looping action to execute the transaction against all the objects in the Work Order collection.  Here again you will need to repeat the following steps for each of the actions that were just created (SetSortWONum, SetSortPriority, SetSortType, SetSortDueDate).


Create Action to loop over the Work Orders and set the CurrentSort property


  1. Create a new action and set the Name, Group and For Object
    /wp-content/uploads/2016/08/5createaction_1009287.png
  2. Select the Action Steps properties tab
  3. Add a SubAction Action Step to loop over the work orders and call the action/transaction to update the CurrentSort property.
    /wp-content/uploads/2016/08/8loopactionstep_1009291.png


Once all the actions are in place we can tie it all together in the UI. 


We will start with setting the sort on the List Tile control to use our new CurrentSort property.  Out of the box the sort is set to WONum.  Select the WorkOrderTileListView Screen Set, the WorkOrderTileListView_Detail_iPad Screen and the TileList Field.  Change the Fixed Sort Property to CurrentSort.

/wp-content/uploads/2016/08/9sortprop_1009296.png



The last step is to create the buttons for the user to choose which sort they want to apply.  The buttons need to be added to the same screen containing the Tile List.  We will add a new toolbar button as well as buttons for each of the looping actions.


/wp-content/uploads/2016/08/10buttonslist_1009297.png

You will need to add an appropriate image to use for the toolbar button.  I created a simple sort icon but you can use anything you feel is appropriate.  The screen shot below shows the properties of the Toolbar button.


/wp-content/uploads/2016/08/11sortmenu_1009326.png


In addition to the popup menu, for each sort property we also need an action button to invoke the looping action (SortOnWONum, SortOnPriority, SortOnType, SortOnDueDate).  Add a button for each of the actions setting the properties similar to the screen shot below.


/wp-content/uploads/2016/08/12loopbutton_1009327.png


Once all the buttons have been created you are ready to publish and test.  After transmitting from your client the Work Order list should look similar to the example screen included at the beginning of this post.

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Matthias Heitmann

    Hi Bill,

    thanks for the helpful information for this additional sorting capability. Is there anything special to be considered for the date field (as it should not be sorted as a “string” but rather as the date).

    Thanks,
    Matthias

    (0) 
  2. Bill Froelich Post author

    Yes, for a date you should probably format it in yyyyMMdd format so that the dates sort correctly.  Instead of directly mapping to another property you can use a rule to format the date into the CurrentSort property.

    –Bill

    (0) 

Leave a Reply