Show All

# About secondary data sources

Microsoft Office InfoPath 2003 Service Pack 1 adds the ability to connect multiple data sources to a form simultaneously. Using multiple data sources in your forms allows you to build complex functionality such as lookup lists or offline data stores.

## Main and secondary data sources

The main data source corresponds to the groups and fields containing the data that underlies the form and is saved as the form file.

A secondary data source is used to store data from additional data sources. Whenever a new data connection is created for retrieving data— for example, by using the Add button of the Data Connections dialog box— the retrieved data is not stored in the main data source but in a secondary data source. The secondary data source receives the data from any data connection used for querying, whether it is an XML document, a database, a Web service, or a SharePoint library or list.

The Data Source task pane displays the structure (groups and fields) of each data source, both main and secondary, and is used for binding groups or fields in the data source to controls in the form. When a user fills out the form, the controls display the data from the data source and allow it to be updated during editing.

## New features for working with secondary data sources

The following sections describe the changes made to working with secondary data sources in InfoPath Service Pack 1.

The Data Connections dialog box

The Secondary Data Sources dialog box, which was accessed from the Tools menu, has been replaced by a new Data Connections dialog box that provides a single place to manage all data connections. The data connections are of the following types:

- The main connection for a form, which is created by using the New from Data Connection command in the Design a Form task pane.
- Data connections used to retrieve data, which are associated with secondary data sources.
- Data connections used to submit data.

The Data Connections dialog box allows you to add data connections for submitting or retrieving data, modifying existing data connections, and removing existing data connections. It also displays a summary of the current settings for each data connection.

Data Source task pane

The Data Source task pane in InfoPath Service Pack 1 provides a drop-down list of available data sources, so that both the main data source and secondary data sources can be displayed. Groups and fields from secondary data sources can be dragged onto the form, as can groups and fields from the main data source, to create controls for displaying or editing their data.

Fields and groups

A drop-down list similar to one in the Data Source task pane is available in other situations in which the user can choose a group or field. For example, it is now possible to choose a field or group from a secondary data source when doing the following:

- Changing the binding on a control in the view.
- Setting conditions for data validation.
- Setting conditions for conditional formatting.
- Setting the data to be submitted as parameters to a Web service.
- Inserting formulas.
- Setting conditions in rules.

Note Data in secondary data sources is not saved with the form, so making secondary data sources editable in the form makes sense only in certain scenarios. You can display high-level secondary data source content simply by dragging a high-level secondary data source node from the Data Source task pane into the view and choosing Section with Controls. Text boxes can be made read-only, if needed.

Controls available for binding to secondary data sources

The following controls can be bound to secondary data sources with no restrictions on their behavior:

- Date Picker
- Drop-Down List Box
- Ink Picture
- List Box

The following controls cannot be bound to secondary data sources:

- Custom Controls
- File Attachment
- Master/Detail
- Optional Section

The following controls can be bound to secondary data sources, but with some restrictions on their behavior:

Control | Behavior
--- | ---
Check Box | All features enabled, except that the value of the Default state property of the control is Cleared and cannot be changed
Choice Group | No insertion, deletion, or replacement of groups
Choice Section | No insertion, deletion, or replacement of sections
Linked Picture | No browsing
List (Bulleted, Plain Numbered) | Can edit text, but cannot add items
Option Button | All features enabled, except that the This button is selected by default property check box is cleared and disabled
Picture | No browsing
Repeating Choice Group | No insertion, deletion, or replacement of groups
Repeating Recursive Section | No insertion, deletion, or replacement of sections
Repeating Section | No insertion, deletion, or replacement of sections
Repeating Table | No insertion, deletion, or replacement of rows
Rich Text Box | Read only
Section | No insertion, deletion, or replacement of sections
Text Box | The Enable spelling checker and Enable AutoComplete check boxes cannot be turned off

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp