Choosing builders that control the validation, formatting, labels, and behavior of data fieldsAdded by IBM on June 28, 2011 | Version 1 (Original)
|These builders control the validation, formatting, labels, and behavior of data fields.
These builders control the validation, formatting, labels, and behavior of data fields.
Table 1. Builders to control the validation, formatting, labels, and behavior of data fields
|Task||Builder you should use|
|Add formatting or validation to a field or to an element in a schema. For example, you can:
- Format the field (for example, format the data in an acceptable date format)
- Translate an expression (for example, remove dashes from a formatted string to that it can be properly saved)
- Validate the field being submitted (for example, ensure that the Birthday field is a date).
|The Data Field Settings builder or the Data Field Modifier (DFM) builder can help with these tasks. Using the Data Field Settings builder, you can take advantage of definitions in the default base rich data definitions (RDD) file or change the default RDD file used in the model. The RDD file lets you reuse a single shared library of common field types. You can change both field display and field validation settings for one page or selected pages in the model. Use this builder to make general changes limited to a few settings.|
The Data Field Modifier builder is available to control all the possible data field and validation settings for your model. Use the Data Field Modifier builder for detailed customization of specific page elements.
|Make column names easier to read. For example, rather than displaying CUSTOMER_NAME, to just display the word Customer.||Use the Data Field Settings builder to control all the page automation fields in a model including formatting and validation.|
Rich Data Definition builder (RDD) can help with these tasks, RDD is the best choice because you can use this builder to encode and reuse detailed field behaviors. You can enable reuse at the schema level by creating an RDD file for a particular schema, and you can also reuse a single shared library of common field types, with the base data definition functionality.
Rich Data Definition builder can also be used to apply Dojo controls along with validation and formatting to form fields. This usage lets you apply the Dojo widget information to schema elements, which is reflected during user interface (UI) generation. In the RDD builder, select the Dojo base data definition library.
To generate your own data definition file, use the RDD's builder interface to set the appropriate formatting and validation. Then, scroll down to the bottom of the builder and click the Create Data Definition File button.
|Change the behavior of a field in a view or a form:
- Make the field a data entry control (such as a text input, text area, select, or check box).
- Make the field view only (for example, text or image).
- Make the field an action field (such as a link, button, or image button).
|Use the Data Field Settings builder to control all the page automation fields in a model including column names.|
The Data Column Modifier builder and Rich Data Definition builder can also be used to change the labels that are displayed in your portlet.
The Localized Resource builder can also be used to change column and field labels, and it can support multiple languages. It lets you pick a resource bundle, which it imports into a variable in your Model. You can then use the values from that variable to localize text strings in your model, such as button or column labels. After you have added the Localized Resource builder to your model, the next step is to open up the builder that created the fields (View & Form builder or some other builder based on Data Page), and scroll down to find the Label Translation section. From there, select the locale data or resource bundle you are using.
|Translate an existing value into a meaningful name. For example, instead of displaying the Department Code, to display the Department Name. |
You have an edit form that allows users to select a name (like Department Name), but you want to save the associated value (like Department Code).
You want to populate a select list (or similar control) with a value that is not returned from your database, such as a blank.
|The most common way to do this is by adding a Lookup Table builder to your Model. The Lookup Table builder creates a lookup table, which is used to translate between some computer-readable ID and a human-readable name, often the result of a database query. The table also caches the results across different users, including the opportunity to prevent data from becoming stale. This builder:
Next, add the relevant page control builder to your model, pointing it at the Lookup Table builder. Builders that work with Lookup Table include Data Field Modifier, Select, Text, and Radio Button Group.
- Lets you access a data source by entering an SQL statement, pointing to an XML variable, or typing in some XML.
- Adds to the query results any name/value pairs you want to include in the select list (for example, blank).
- Creates methods that do the translation between name/value pairs.
You can also have the Rich Data Definition (RDD) builder (RDD) automatically create and apply a lookup table. This can be especially useful if you use the same lookup numerous times. See the help for RDD for more information
|Shut off label generation. For example if one of the builders used in a Model generated a label that you do not like. |
Provide my own label for the field.
|The Data Field Modifier is a builder that is useful for a number of different tasks. Basically, this builder can be used to control the page elements created by Data Page builder (as well as the higher-level builders that leverage Data Page). This builder lets you select one or more fields and one or more data types (like double, string, and so on). You can then perform modifications including hiding, formatting, labeling, and determining the display of child elements.|
The Data Field Settings and Data Column Modifier builders can be used to specify field labels.
Parent topic: Choosing builders for common tasks