Design a form template by using settings in a data connection library in InfoPath 2007

Author: mety Labels::



This article shows you how to design a form template, which is based on the settings stored in a data connection library on a Microsoft Office SharePoint Server 2007 site, that can either query or submit data.

A secondary data connection is any data connection to an external data source that you add to a form template. This data connection is different from the main data connection that is created when you design a form template based on a database, Web service, or settings in a connection library. You add a secondary data connection only if you cannot query or send data through the main data connection.
A form can have one primary data connection, called the main data connection, and it can optionally have one or more secondary data connections. Depending on your goals for the form, a data connection might query or submit form data to an external data source, such as a Microsoft SQL Server database or a Web service.
If you are designing several form templates that use similar data connections, consider using a data connection file instead of creating a data connection to an external data source for each form template. This way, you need to update only one data connection file when the data connection information changes for a set of related form templates. For example, when you move your form templates from a test network to a production network, you need to update the data connection settings only once in the connection library instead of updating the data connection in each form template. When a form based on a form template that uses a data connection file uses the data connection, the data connection is automatically updated with the new settings.
A data connection file is an XML file with an .xml or .udcx file extension that contains connection information for a single external data source. This file is stored in a data connection library on a server running Microsoft Office SharePoint Server 2007. A data connection file is created by a developer or by converting a data connection in an existing form template into a data connection file by clicking the Convert button in the Data Connections dialog box (Tools menu).
Advantages of using data connection files include:
  • Multiple forms can use the same data connection file, so there is no need to create the same data connection from scratch for each form template.
  • If the location or connection settings for an external data source change, you need to update only the data connection file, not each form template.
  • The data connection file can contain alternative authentication information that can be used by the server when a user fills out a form by using a Web browser.
  • Forms based on a browser-compatible form template that are filled out in a browser can connect to servers in another domain only with data connections that use data connection files.
Microsoft Office InfoPath uses data connection files that follow the Universal Data Connection version 2.0 file format. This version is a superset of the version 1.0 file format used by Microsoft Office FrontPage and Microsoft Office Excel. InfoPath cannot use data connection files in the version 1.0 file format.
When you create a form template that is based on settings in a data connection file, Microsoft Office InfoPath creates a data connection that is based on the settings in the data connection library. If the data connection file contains settings for a query data connection, InfoPath creates the form's main data source (data source: The collection of fields and groups that define and store the data for an InfoPath form. Controls in the form are bound to the fields and groups in the data source.) with query fields (query field: A field that can contain a value that is used in a query.), data fields (data field: A field that contains the result of a query to an external data source.), 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.) that correspond to the way that data is stored in the external data source that is referenced by the settings in the data connection file. Query fields contain the data that the external data source uses to determine what to send to the form. The results of the query are put into data fields. To enable users to query the external data source, InfoPath adds a Run Query button to the form template.
Because the data structure of the query and data fields must match the way that data is stored in the external data source, you cannot modify existing fields or groups in the main data source. You can only add fields or groups to the root group in the main data source.
If you are using settings for a submit data connection, InfoPath enables the Submit button on the Standard toolbar and the Submit command on the File menu of forms that are based on this form template. This allows users to submit the data in their forms to the external data source.

Before you begin

In order to design a form template that is based on the settings in a data connection library, you need the following information from the data connection library administrator or the developer who created the data connection file:
  • The location of the Office SharePoint Server 2007 site with the connection library.
  • The name of the data connection file in the data connection library that you want to use.

Design a form template with a query data connection

In order to design a form template that is based on a data connection file with settings for a query data connection, you must do the following:
  1. Design the form template that is based on the data connection file This step creates the main data source for the form template with the appropriate fields and groups that are based on the settings in the data connection file.
  2. Add a control to the form template that will display the query results To display the data stored in the fields and groups in the main data source to your users, you have to add a control to your form template and then bind that control to a query field or data field in the main data source.

Step 1: Design the form template based on the data connection file

  1. On the File menu, click Design a Form Template.
  2. Under Design a new, in the Design a Form Template dialog box, click Form Template.
  3. In the Based on list, click Connection Library.
  4. If you are designing a browser-compatible form template, select the Enable browser-compatible features only check box.
  5. Click OK.
  6. In the Site list, in the Data Connection Wizard, click the name of the site on the server running Office SharePoint Server 2007 that includes the data connection library.
    1. Click Manage Sites.
    2. In the Manage Sites dialog box, click Add.
    3. In the URL box, type the location of the data connection library.
    4. In the Display name box, type a name for the data connection library. This name will appear in the Site list in the Data Connection Wizard.
    5. Click OK.
    6. Click Close.
  7. Click the name of the data connection library to see a list of data connection files, click on the name of the data connection file that you want to use for this data connection, and then click Next.
  8. If you selected a data connection file with connection settings to a Web service, the next page of the wizard may ask you to specify sample values for each parameter to determine what fields or groups to add to the secondary data source.
    1. Select a parameter in the Parameters table, and then click Set Sample Value.
    2. In the Sample value box, type a value that your user might use for this field, and then click OK.
    3. Repeat these steps for each parameter in the Parameters table, and then click Next.
    When you configure a data connection to a Web service in the Data Connection Wizard, Microsoft Office InfoPath connects to the Web service and requests the Web Service Description Language (WSDL) file. The WSDL file contains the schema used by the Web service. The Web service responds to the request by sending this file to InfoPath. InfoPath uses the information in this file to add the appropriate fields and groups to the secondary data source in the form template. If InfoPath finds an unknown element type in the WSDL file, InfoPath uses sample data to determine the definition of the unknown element type and then adds the appropriate fields and groups to the secondary data source.
  9. If the external data source referenced in the settings returns a Microsoft ADO.NET DataSet, the next page of the wizard asks if you want to include change information when users submit their form data. In most cases, leave the Include change information when submitting data check box selected, and then click Next. If you do not want to include change information, clear the Include change information when submitting data check box, and then click Next. This page in the wizard appears only if the settings are for a Web service and the Web Service Description Language (WSDL) file indicates that the Web service returns an ADO.NET DataSet.
  10. On the next page of the wizard, type a name for the data connection, and then click Finish.

Step 2: Add a control to display the data in the field

  1. If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C.
  2. Drag a control onto your form template.
  3. In the Control Binding dialog box, select the field that you want to bind the control to.

Design a form template with a submit data connection

If the data connection file contains settings for a submit data connection, you can configure your form template to allow users to submit their form data through the data connection. When you do this, InfoPath adds a Submit button to the Standard toolbar and a Submit command to the File menu. You can configure the submit options for the form in the Submit Options dialog box (Tools menu). The submit options are configured in the same way as if you designed a form template based on a database or Web service. Find links to more information about designing a form template that is based on a database or Web service in the See Also section.
  1. On the File menu, click Design a Form Template.
  2. Under Design a new in the Design a Form Template dialog box, click Form Template.
  3. In the Based on list, click Connection Library.
  4. If you are designing a browser-compatible form template, select Enable browser-compatible features only.
  5. Click OK.
  6. In the Site list, in the Data Connection Wizard, click the name of the site on the server running Office SharePoint Server 2007 that includes the connection library.
    1. Click Manage Sites.
    2. In the Manage Sites dialog box, click Add.
    3. In the URL box, type the location of the data connection library.
    4. In the Display name box, type a name for the data connection library. This name will appear in the Site list in the Data Connection Wizard.
    5. Click OK.
    6. Click Close.
  7. Click the name of the data connection library to see a list of data connection files, click the name of the data connection file that you want to use for this data connection, and then click Next.
  8. If you selected a data connection file with connection settings to a Web service, the next page of the wizard may ask you to specify sample values for each parameter to determine the best field or group to add to the secondary data source.
    1. Select a parameter in the Parameters table, and then click Set Sample Value.
    2. In the Sample value box, type a value that your user might use for this field, and then click OK.
    3. Repeat these steps for each parameter in the Parameters table, and then click Next.
    When you configure a data connection to a Web service in the Data Connection Wizard, Microsoft Office InfoPath connects to the Web service and requests the Web Service Description Language (WSDL) file. The WSDL file contains the schema used by the Web service. The Web service responds to the request by sending this file to InfoPath. InfoPath uses the information in this file to add the appropriate fields and groups to the secondary data source in the form template. If InfoPath finds an unknown element type in the WSDL file, InfoPath uses sample data to determine the definition of the unknown element type and then adds the appropriate fields and groups to the secondary data source.
  9. On the next page of the wizard, type a descriptive name for the data connection, and then click Finish.

0 comments |

Labels

Blog Archive

Powered by Blogger.

I made these pages for me and my friends to help solving the problem we face regarding Computer & internet, if anyone wants me to answer a question or find out about some information please send me email and I will try to reply.*P.S. some of the article I wrote and the other I found on the internet I posted them in sprit of learning and shearing, please forgive me if you found something you don’t want to be in my blog, email me and I will delete them. Thank you for your interest in my pages.امل نجم Amal Nagm

banner 1 banner 2