3.1 Updating details child list
With all the changes that we have already made to the model, let's run the application and review what the Sales Order details screen looks like now.

You will notice that the fields, for which we have defined static and dynamic enumerations in the model, such as Status, Sales Person and the Sales Territory highlighted in green, already have drop-down list controls for selecting a value, which display a user-friendly name.
We will start improving the Sales Order details screen by updating the child table with the order line items, which shows the products ordered, their quantities and prices. Looking at the current table, the following updates come to mind.
- Display Product using product name as the first column, which will have a link to the line item details, and move the Carrier Tracking Number to the end.
- Display the special offer using its description instead of the internal ID.
- Remove Row GUID and Modified Date internal columns
- Display Unit Price Discount as percentage, and the Line Total in the currency format.
We will turn the list of products into a dynamic enumeration, since it does not change very often, and is not too large, so it can be cached. Make sure that you set the Make Key Type Enumerated property of the “Enumeration Read List” generator to True, so that it would automatically configure the key type. Next, open up the product.xom file in the model, and run that generator on that file, as shown below.

Expand the generated “read list” operation on the “product” object, and remove any extraneous parameters, except for the product ID and name, which are used as the enumeration's ID and description parameters respectively, as well as the product subcategory ID and the product model ID, which we could use for cascading selection. Also, add a required boolean parameter "is active", which will indicate if this is a current product that has not been discontinued. We will also set this parameter as such on the enumeration configuration, so that it would not prompt discontinued products in any selection lists, but can still use them to decode a product ID into the corresponding name. Your “read list” operation will look as follows.

To add implementation for our “is active” parameter, we will regenerate all code by building the model, and then insert the following custom code into the generated ReadList method of the ProductService.

We will do similar steps for the “special offer” object, generating a “read list” operation decorated with an enumeration declaration.

We will strip it off of any extraneous parameters except for the ID, description, and the category attribute for cascading selection. We will also add "is active" parameter to indicate current special offers, and will set it on the enumeration as well.

Lastly, we will build the model again, and will provide the custom code for the “is active” parameter implementation, as follows.

Now that we have done all these preparations, let's open the “read list” operation on the "detail" sub-object of the "sales order" object. We will remove the Row GUID, and the Modified Date output parameters, drop “id” from the names of “product” and “special offer” parameters to make the proper text on their column headers, and reorder other parameters properly, as displayed below.

Note that these parameters will be added to the SalesOrderDetailList data object, which we will use to update the labels for the details table columns later. For now, let's address the issues with the formatting of the “unit price discount” and “line total” fields. You can see that based on their SQL types the price discount was imported with type “money” and the line total was imported with a generated type numeric_38_6, which even has a warning on its definition saying that it extends a deprecated type "numeric".

For the unit price discount field, we will define a new type “discount” in the sales_order.xom, and use it for this field. The “discount” type will inherit from the “percent” base type to format the value as a percent, and also override the data property to use the PercentFractionProperty, which validates that the value is a fractional number between 0 and 1. We will also use a SQL type override, so that it keeps the mapping to the original SQL type, as shown below.

Now, if you right click on the “numeric_38_6” type, and select Find All References, you will see that it is used solely on our “line total” field”. Therefore, we will just rename this type to be "line total", move it to the same file sales_order.xom, make it inherit from the "money" type to make sure that it gets formatted as currency, and also keep the SQL type configuration override, as shown below.

Next, let's open the SalesOrderDetailList data object, and provide some custom labels for our columns. We will also update the “details” link to be displayed on the field “product”, as follows.

After you build the model one more time, and run the application now, you'll see that the Sales Order Detail grid looks exactly according to the requirements that we defined earlier. Below is a picture that illustrates this.

As you see, it only shows the columns we specified using our labels as column headers, the product and special offer show names instead of IDs, the Discount field is formatted as percent, and the Line Total field is displayed using currency format.
Next: 3.2 Handling read-only fields >