This article is part of a series of documents explaining the Data concept in Microsoft Office InfoPath. This particular article is an overview of how Data Connections work in InfoPath. The intended audience is those who are new to InfoPath and those who use InfoPath, but have not built up knowledge in the way Data Connections work. For more exhaustive information regarding specific types of data connection, see the Links section at the end of this article.
Definitions of certain terminology in this paper are as follows:
The purpose of using an InfoPath form is to collect structured data. This data structure is represented by a schema (XSD) which defines the data fields and the hierarchical structure of the data.
When using InfoPath client, data is accessible through data connections. These data connections are defined in the form template and used at runtime. During design of the form, the form designer will create the data connection. The designer must choose to either create new settings for a data connection or search for existing connections previously defined by an admin on a SharePoint server. In general, the data connection paradigm in InfoPath 2003 and 2007 is such that data connections are grouped into one of two types – submit connection type or receive (query) connection type. Receive connection types have a one-to-one relationship with secondary DOMs.
Submit Data Connections
Consider this scenario. The form filler places data into all of the fields on the form, presses a button labeled “Submit my data” and the data is pushed to some listener where it can be stored or processed.
As simple as this scenario is, it must be configured by the form designer through the Submit type of data connection. After creating a submit data connection, the designer can apply the data connection to a user action – in this case, the button labeled “Submit my data”. When the filler executes that action, data in the main DOM of the form is transmitted to the target of the data connection as a submission.
Submit data connections can currently bind to the following destinations:
Receive Data Connections
One of the major problems in filling out forms is accuracy of data. For instance, if someone was replying to a survey regarding what their favorite programming language is, they could have a text box to type it in. Now imagine that there are 50 respondents to the survey, each trying to explain in a text string what their favorite language is. Consider for a moment that it is C#. They could respond with any of the following and be just a correct or valid: C#, C-Sharp, Csharp, C, C# .NET. Obviously, allowing this type of data entry will create problems when the survey is interpreted.
This type of scenario is a good reason to use a Receive data connection. What if the form designer was to pre-populate a drop-down control with specific choices which the filler could choose as their favorite programming language? The designer could create a list such as: VB, C++, VB.NET, C# and would thus ensure that the filler would be able to be successful in filling out the form with valid data that is consistent across all of those who respond. The person who aggregates the responses from the form will also be able to ensure that they have interpreted the data correctly and completely.
To configure this scenario, the form designer now needs to create a Receive connection type. A receive data connection allows a query to be made to get data from an external source and return it to the form. External data is placed into the form as a secondary data source (represented as another DOM). Controls can then be configured to use these fields. Also, the designer can view the additional data sources by viewing the Data Source task pane and using the drop down to switch between data sources. If the dropdown is grey, then there is only one data source in the form.
Receive data connections can currently connect to the following sources - all of these are supported in InfoPath 2003 and 2007:
For further and comprehensive information regarding data connections in InfoPath, see http://office.microsoft.com/en-us/infopath/HP012304861033.aspx?pid=CH100598301033
For more information specific to data connections to Web Services, see http://office.microsoft.com/en-us/infopath/HP100913971033.aspx?pid=CH100598301033
For more information on using InfoPath with Access, see http://office.microsoft.com/en-us/infopath/HP100950831033.aspx?pid=CH100598301033
For more information on using InfoPath to connect to SharePoint data sources, see http://office.microsoft.com/en-us/infopath/HP100931601033.aspx?pid=CH100598301033
For general topics of interest and further How To information on InfoPath data connection, see http://office.microsoft.com/en-us/infopath/CH100598301033.aspx
Patrick SmithProgram Manager
Thanks Patrick! A good overview of data connections, and the definitions to distinguish between XML forms and XSN form templates will be especially useful to those just beginning to use Infopath.
Is it possible to create a template for a form that uses a RELATIVE url to a data source.
In your example:
I have several sites with a formlibrary to which I want to publish the form. Each site has it's own list/datasource of programming languages.
(actually I have a Site template that should contain the form and secondairy datasource)
There is no way to do this without writing code. The two methods of doing this with code are:
1. set up the connection as a Web service call to the lists web service on SharePoint. Use custom code in your form template to set the URL of the Web service at runtime based on the URL the form was opened from, and then execute the Web service connection.
2. When the form is hosted in the XmlFormView control, either in a client application or on MOSS, you can set up your data connections to specify that a portion of the serviceURL of the Web service can be dynamically replaced at runtime. This requires adding an element to the extensions section of manifest.xsf:
<xsf2:solutionDefinition compatibility="RICHCLIENT REACH" hash="...">
<xsf2:webServiceAdapterExt ref="ws" trackDataSetChanges="yes">
<xsf2:relativeQuery replace="http://janky/poltergeist/floop" />
The xsf:relativeQuery element specifies a substring of the ServiceURL which will be replaced at runtime by the value of the DataConnectionBaseUrl property on the XmlFormView control. Your hosting page or hosting application needs to set the DataConnectionBaseUrl property before the form is loaded.
This is difficult to do for a SharePoint list, since we use the GUID of the list, rather than the URL, to identify the list to query. This may change in a future version.
Are you looking for the ability to query relative to the SharePoint site, or the SharePoint site collection? Knowing this would help us understand how best to implement the relative URL functionality if we add it in a future release.
Hi I have set up a access database on a doc library and a infopath form based on this db published to a nearby folder. When I go to fill out the form, and it opens, I hit submit. But then it gives me a JET DB initilization form with login of admin and a blank pass. When I hit ok, it gives me a error saying
infopath The Microsoft Jet database engine cannot open the file '\\220.127.116.11\sites\Safety_and_Training\Experimental\db1.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
For some reason, once or twice its randomly been able to submit succcessfully but I havnt been able to reproduce the situation. Are there files that i am missing? any permissions that I need to check? The access database only has a admin and no password account. PLEASE HELP ME ive been working on this for ages! If you know a solid workaround with little programming let me know.
I need to make a form that should work in the browser so i lost many control options and I need to get records from the DB according to the logged user. How to be able to bind non repeating controls to datasource ???? Any Guidance would be appreciated. Thanks in advance.
Can anyone help me?
New to this blog. I have an infopath form tied to an access database. Only thing is, any time I add a control, it forces me to bind it to the database. Most times, this is ok. other times, I am trying to create the optional sections.
O single day event
O multi-day event
How do i unbind the radio buttons above, from the database?
I need some help for a project I am doing.
I am using infopath2007 with an Access2007 database.
I have 3 tables
1)tblInformation (Name, ID, startdate...) //non-repeating
2)tblFunding (ID, Participants, Amount...) //repeating
3)tblApproval (ID, Name, Position, Status...) //repeating
I want all these related by ID in a One to Many relationship.
(Unfortunately, Infopath wont let me submit data if fund and approve dont have primary keys so I made a unique index# for each table and related those aswell.)
tblInformation -1:M- tblFunding
tblInformation -1:M- tblApproval
I have 1 nonrepeating section for Info and 2 repeating sections for funding and approval.
Problem: When I try to submit with a section repeated more than once i get a 'Empty row cannot be inserted. Row must have at least one column value set.'
I assume this is happening
tblInfo | tblFunding | tblApproval
stuff | stuff | stuff
null(error) | cant submit more stuff
^because i only enter tblInfo once.
Im not sure how to get around this issue because Infopath and Access have so many restrictions. Any help would be greatly appreciated.
Body: I've been getting some curly questions around InfoPath of late due to our organisation already
We have a MOSS site set up for a client, it has a sub site for each of their clients and then another site below client for each project. At the project level there is an infopath form which has data connections to lists at both the other levels. Our client needs to be able to set up new projects and clients at these levels, we are allowing this using templates. This does however mean the data connections on the infopath form need to be relative. Could you elaborate on what you have written above as to the best wayt this could be achieved please ?
I have two database connections in my infopath form. However, since there is a many-to-one relation between the tables, I cannot submit data through Infopath.
I am trying to submit data through code but its not working. Can someone please help?
I am using InfoPath 2007. When I set up a data connection to receive data from a SharePoint list, I have run into a restriction that I've not seen documented anywhere, and so I wonder if there is a way to do what I need.
The SharePoint list I am wanting to use has a single column, type people or grep, which has the "allow multiple selections" property set. This is so that the column can contain 1 to many people selected for that particular row, without having to create a limiting number of columns.
When I try to create the data connection in InfoPath 2007, the column is not displayed as one that can be returned.
Once I turn off the "multiple selection" property, the column becomes available.
Is there some alternative method to accessing the data?
If not, I sure hope this is in the works for a near future patch release...
I have a Infopath form designed and have a data connection to the sharepoint. the form consist of a feilds of user information which submits data to a data library in sharepoint.
Now I want to know how can i store multiple copies of same form but with of different users and with that form name as of the name feild in the form entered by the user.
so if I enter my details in form and press submit then the form should store on sharepoint library with my name(I have connection established).
please let me know if any can help me, thanks in advance.
I am trying to connect to a SQLsever view, and Infopath crashes repeatedly!
Is this a BUG in Infopath? Pretty severe limitation.
I can connect to this same view, database connection, from Excel.
Patrick, great information. I have a 2007 InfoPath that links (submit button)to an 2007 Access database and works well for users with Office 2007. However, users with Office 2010 are not able to "Submit" and receive an error that that the form cannot connect to the datebase. I read that Infopath 2010 was supposed to be able use 2007 Submit buttons, but its not working here. Any suggestions?
This is useless information. Typing excercise?