Tuesday, March 13, 2012

Order Details: Reshaping Grid View

The Order Details grid view displays several unnecessary reference fields, such as Order Customer Company Name, Order Employee Last Name, and Order Ship Via Company Name. We will get rid of these redundant fields. Let’s also display the average Unit Price, total Quantity, average Discount, and total sum of Extended Price.

Order Form page with redundant fields and without aggregates

In the Designer, expand to Order Form / c100 / dv101 / grid1 node. Right-click on OrderCustomerCompanyName data field and press Delete. Also, delete the data fields called OrderEmployeeLastName and OrderShipViaCompanyName.

Delete option for data fields in Code On Time Designer

Now that the redundant data fields have been removed, let’s assign aggregates. Double-click on UnitPrice. Change the Aggregate Function property field to “Average”.

'Unit Price' aggregate function of 'Average'

Press OK to save the data field.

Next, double-click on Quantity and change Aggregate Function to “Sum”.

'Quantity' aggregate function of 'Sum'

Save the data field, and double-click on Discount. Change Aggregate Function to “Average”.

'Discount' aggregate function of 'Average'

Press OK, and double-click on ExtendedPrice. Change Aggregate Function to “Sum”.

'Extended Price' Aggregate Function of 'Sum'

Press OK to save Extended Price data field. Generate the application, and navigate to Order Form page. Select any order. You will see that the list of order details will not display redundant order information, and displays aggregates at the bottom of the grid.

Order Form page with aggregates in Code On Time web application

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.


© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com