To enable inserting and updating, you need to add a date format for the dateReleased text field element. The dateReleased attribute is stored as an NSCalendarDate object in Movie objects, but it is represented as an NSString object in the text field. Assigning a date format alerts the Movies application that it needs to translate between NSCalendarDates and NSStrings. For more information, see the NSCalendarDate and NSString class specifications in the Foundation Reference.
Assigning a date format also allows you to display dates in a more customary format. For example, you can transform a date from its default format (1981-12-27 00:00:00 -0700, for example) to any of the following:
In this section, you'll enable inserting and updating by adding a date format, and you'll improve the display by adding a number format. In addition, you'll configure the movies display group to sort the movies it displays. You should also consider changing the labels of your text fields (for example, change "title" to "Title").
The inspector that opens displays bindings, attributes, and other settings for elements in a component. Each element occupies a place in the component's HTML hierarchy. For example, a text field element is contained in a form element, which is contained in a page. A page is the highest level in the hierarchy. As shown below, you can use the inspector to traverse the hierarchy from the selected element on up.
The dateReleased text field element is selected, so the inspector shows icons for the text field and its parent elements-the surrounding form and the page. All dynamic elements can have as many as two icons in the inspector's icon path: one for inspecting the HTML attributes of the element and a gears icon for inspecting the element's bindings.
Using this date format ("%d %b %Y"), the Movies application formats the date "1995-12-3 00:00:00 -0700" as "3 Dec 1995". The %d conversion specifier stands for day of the month, %b stands for the abbreviated month name, and %Y stands for year with century. You can create your own date formats with any of the conversion specifiers defined for dates. For more information, see the NSCalendarDate class specification in the Foundation Reference.
Using this number format ("$ #,##0.00"), the Movies application formats the number 1750000 as "$ 1,750,000". For more information on creating number formats, see the NSNumberFormatter class specification in the Foundation Reference.
The checkmark button is only enabled when a WODisplayGroup object is selected in the object browser.
In the DisplayGroupEditor panel that opens, you can configure the movies display group to sort the Movie objects it fetches from the database.
Try inserting and updating movies using dates and numbers in different formats. In particular, date formatters are very flexible. Try entering the following date released values for a selected movie:
Table of Contents Next Section