Welcome to SqlServer-QA.net Sign in | Join | Help

Sharepoint Server and SQL Server connectivity (SSQA.net)

Content Management, Paperless office and share your information in an Enterprise. Tips and Tricks in using Sharepoint along with your SQL Server database.
Using the Filter Feature in InfoPath web forms

There is a great feature in infopath - Filter. Unfortunately this Feature is not available in Web Forms. Here ia a way to simulate this functionality.

1. The first step is to create a new form in infopath and add 2 Data Connection.

2. The First Connection to the Parent Lists
Tools--Data Connections--Add--Receive Data--SharePoint library or list--Select "Parent Library"---click next until the wizard finishes

3. The Second Connection to the Child Lists. with one difference in the configuration:
Tools--Data Connections--Add--Receive Data - XML -- in the Url type in
"http://server/_vti_bin/owssvr.dll?Cmd=Display&List={put the GUID of the Child Lists here}&XMLDATA=TRUE"

4. Add 2 Fields on the Form for the Parent and the Child DataConenction

5. Add the 2 fields as a DropDown Lists on the Form

6. Change the mappings for each Dropdown to the new Data Conenctions.

7. Now we must add some code on the Change Event of the Parent dropdown to populate
public void parent_Changed(object sender, XmlEventArgs e) { SetChildOptions(); } private void SetChildOptions() { FileQueryConnection q = (FileQueryConnection)this.DataConnections["Child"]; q.FileLocation = q.FileLocation + "&FilterField1=Parent&FilterValue1=" + GetStateValue(); q.Execute(); } private string GetparentValue() { XPathNavigator nav = this.CreateNavigator(); string filterValue = (string)nav.SelectSingleNode("/my:myFields/my:parent", this.NamespaceManager).ValueAs(typeof(string)); return filterValue; }

 8. Add a rule to the parent ddropdown to re-query a data connection  and choose the Child Connection.

 

 

 

 



 

Published Tuesday, March 18, 2008 3:04 AM by Akthar

Comments

# Sharepoint Server and SQL Server connectivity (SSQA.net) : Using the Filter Feature in InfoPath web forms @ Tuesday, March 18, 2008 12:19 AM

PingBack from http://sqlserver-qa.net/blogs/sharepoint/archive/2008/03/18/using-the-filter-feature-in-infopath-web-forms.aspx

Sharepoint Server and SQL Server connectivity (SSQA.net) : Using the Filter Feature in InfoPath web forms

# Using the Filter Feature in InfoPath web forms @ Tuesday, March 18, 2008 2:10 AM

There is a great feature in infopath - Filter. Unfortunately this Feature is not available in Web Forms

Other SQL Server Blogs around the Web

Anonymous comments are disabled