The data source, which stores all of the data entered into a form, is made up of fields (field: An element or attribute in the data source that can contain data. If the field is an element, it can contain attribute fields. Fields store the data that is entered into controls.) and groups (group: An element in the data source that can contain fields and other groups. Controls that contain other controls, such as repeating tables and sections, are bound to groups.). In the same way that folders on your hard drive contain and organize your files, fields contain the data in your form, and groups contain and organize those fields. For example, the fields for first name, middle name, and last name can be contained in a group called "name."
You can work with your form's fields and groups in the Data Source task pane.

Field
Group
The controls (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.) on your form are bound (bind: To connect a control to a field or group in the data source so that data entered into the control is saved. When a control is unbound, it is not connected to a field or group, and so data entered into the control will not be saved.) to the fields and groups in the data source; this binding allows data entered into a control to be saved. Information entered into a bound control is saved in the field it is associated with.
Although the structure of the data source does not always exactly match the layout of your form, similarities are common, particularly for groups and fields associated with repeating tables (repeating table: A control on a form that contains other controls in a table format and that repeats as needed. Users can insert multiple rows when filling out the form.), sections (section: A control on a form that contains other controls.), repeating sections (repeating section: A control on a form that contains other controls and that repeats as needed. Users can insert multiple sections when filling out the form.), and optional sections (optional section: A control on a form that contains other controls and that usually does not appear by default. Users can insert and remove optional sections when filling out the form.). For example, a table or section is bound to a group in the data source, and all of the controls in the table or section are bound to fields that are part of that group. In the following illustration, the Itemized Expenses repeating table consists of three columns containing a Date date picker, a Description text box, and a Cost text box. These controls are bound to a date field, a description field, and an amount field. The table itself is bound to the item group.

Using the Data Source task pane to insert controls
You can insert controls by dragging fields and groups from the Data Source task pane onto your form. Each time you drag a field or group onto your form, Microsoft Office InfoPath 2003 suggests the control that best matches
that field or group—that is, the control that accepts the type and structure of data associated with the field or group. If the field has a date data type (data type: Property of a field that defines the kinds of data the field can store. Examples of data types include Text, Rich Text, Whole Number, Decimal, True/False, Hyperlink, Date and Time, and Picture.), for example, InfoPath suggests you insert a date picker control. If the group is repeating and contains three fields, InfoPath suggests a repeating table or a repeating section.
Tip
Remember that you can drag the group that contains a set of fields to automatically create repeating tables, repeating sections, and sections. To see all of the control recommendations for a field or group, right-click the field or group in the Data Source task pane.Modifying fields and groups in the data source
When working directly with the data source in the Data Source task pane, you can add, move, reference, and delete fields and groups. In addition, you can change the following properties of fields and groups:
Name The name of the field or group. Names cannot contain spaces. They must begin with an alphabetic character or underscore ("_"), and they can contain only alphanumeric characters, underscores, hyphens ("-"), and periods (".").
Type The type of field or group. Types
include element field (the standard type of field), attribute field, group, choice group, and complete XML document or Schema. Fields store data that is entered into controls; groups contain fields and cannot store data. Choice groups store data associated with choice group controls. You can use the complete XML document or Schema type to add XML (Extensible Markup Language (XML): A condensed form of Standard Generalized Markup Language (SGML) that enables developers to create customized tags that offer flexibility in organizing and presenting information.) documents or XML Schemas (XML Schema: A formal specification, written in XML, that defines the structure of an XML document, including element names and rich data types, which elements can appear in combination, and which attributes are available for each element.) to a specific part of the data source.
Data type Defines the kinds of data that the field can store. Data types include Text, Rich Text, Whole Number, Decimal, True/False, Hyperlink, Date, Time, Date and Time, Picture, and Custom, which is for fields associated with Microsoft ActiveX controls. Only fields can have data types.
Default value The initial value that a field has when the form is first opened by a user. You can also add formulas to default values, such as the current date, a mathematical calculation, or a reference to another field.
Repeating Determines whether the field or group can occur more than once in a form. List controls, repeating sections, repeating tables, and controls that are part of a repeating section or repeating table are bound to repeating fields (repeating field: A field in the data source that can occur more than once. Controls such as bulleted, numbered, and plain lists; repeating sections; and repeating tables can be bound to repeating fields.) and repeating groups (repeating group: A group in the data source that can occur more than once. Controls such as repeating sections and repeating tables are bound to repeating groups.).
Cannot be blank Determines whether the field must contain a value. If the field cannot be blank, any control bound to the field that does not have a value entered into it will be marked with a red asterisk or, for some types of controls, a dashed red border.
Note If your users have already filled out forms based on your form template (form template: In InfoPath, a file or set of files that defines the data structure, appearance, and behavior of a form.), the following changes can cause data loss in those forms:
- Moving, deleting, or renaming a field or group
- Changing a repeating field or group to a nonrepeating field or group
- Changing a rich text data type to a different data type
If you want to store the same type of data in more than one place—such as a billing and shipping address in an invoice form—you can create matching fields and groups. When you reference a field, InfoPath creates a new, identical field whose properties are linked to the properties of the original field. Both fields become reference fields, and a change to one field updates the other field automatically. Reference groups, like reference fields, share the same properties; in addition, they contain the same fields and groups.
Understanding the relationship between the data source and an XML Schema
The forms that users fill out are stored as XML documents. When you create the data source for a form, you are actually creating an XML Schema, which is an XML-based file that determines the structure of those XML documents. Each group in the data source is an XML element that can contain other elements and attributes but not data, and each standard field in the data source is an XML element that can contain data. Each attribute field is an XML attribute. You can view additional schema details on the Details tab in the Field or Group Properties dialog box.
Existing XML Schemas, XML documents, databases, and Web services
When you design a form based on an existing XML Schema, InfoPath creates a data source that is based on that XML Schema. The more detailed your XML document is, the more detailed the resulting data source will be. Because using an existing XML Schemas can be more restrictive than designing a new, blank form, you cannot modify existing fields or groups in the data source. In addition, depending on the structure of the XML Schema, you might not be able to add fields or groups to part or all of the data source.
When you design a new form that is connected to a database or Web service, InfoPath builds a data structure for your form based on that database or Web service. The resulting form can be used to query or submit data to the database or Web service. Because the data source must match the database or Web service, you can only modify new fields or groups in the data source, and you can add fields or groups only to the root group in the data source.
Secondary data sources and data connections
In addition to the main data source for your form, you can create data connections to XML documents, databases, Web services, or Microsoft Windows SharePoint Services libraries and lists. These data connections result in secondary data sources, which can be used to populate list boxes, and provide the values for text boxes and other controls. With some exceptions, including specifying default values and direct editing of the fields and groups, you can work with secondary data sources in the same way that you work with the form's primary data source. In addition, you can query and submit data using data connections. For more information about data connections, see About data connections.
Note The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed.