Monday, March 5, 2012
Orders: Setting a Sort Expression

Now that the Order Form page has been set up, we will want to customize several settings. First, we shall optimize the Orders controller. The list of order is currently displayed in alphabetical order of Customer Company Name. It would make more sense to sort the orders according to the date the order was made. Switch back to the Designer, and open the “dv100” Orders data view in the Explorer. Double click on grid1. Scroll down to the Sort Expression field, and enter “OrderDate desc” (do not enter the double quotes).

Sort Expression for a View in Code On Time Designer

Press OK to save the view, and press Generate to regenerate the application. If you navigate to Order Form page, you will see that the orders are sorted in descending order of Order Date.

Orders sorted by Order Date