Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / April 2007

Tip: Looking for answers? Try searching our database.

Seconday datasource based on field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
esebastian@esolutionsgroup.ca - 05 Apr 2007 21:52 GMT
Hello Everyone,
New to Infopath and using infopath 2007. I would like to know how to
do the following:
I have a drop down box that lists a bunch of things.  I have a field
in the datasource and when the field has a value in it i want to
filter the contents of the drop down box from the value in the
textbox. The contents of the drop down box come from the database via
a seconday datasource and it is filled when the form is opened. So
when the text changes on the field i want to re-query the drop down
box so that the contents of the drop down are based on this field...
does anyone know how to do this???
Thanks,
Erin
psiEnergos - 11 Apr 2007 01:28 GMT
I have not used InfoPath 2007 yet but I am sure the concept is the same;  You
will need to call the secondary data connection from script (or managed code)
using the node content of the selected index of your drop down (which is tied
to an underlying XMLDOMNode)

This link explains how to do it:

http://support.microsoft.com/kb/826994

If your form is managed code then this link explains how to do it in C#
http://aspalliance.com/498

The key is the IXMLDOMDocument3 object.  Just make sure you provide yu
secondary data source with parameter values and you should be good to go.

Hope this helps.

> Hello Everyone,
> New to Infopath and using infopath 2007. I would like to know how to
[quoted text clipped - 9 lines]
> Thanks,
> Erin
esebastian@esolutionsgroup.ca - 12 Apr 2007 14:03 GMT
Thanks so much for your response psiEnergos. Here is the code i used
to make this happen..

Ok i've figured this out.. here's how i've done this in infopath 2007.

if ( e.NewValue != "" )
{
DataConnection objADOAdapter;
AdoQueryConnection connection;

objADOAdapter = this.DataSources["NavigationGroups"].QueryConnection;
connection = ( (AdoQueryConnection)( objADOAdapter ) );

// Retrieve the field in the InfoPath form whose value will be used in
the WHERE clause
XPathNavigator node = this.CreateNavigator().SelectSingleNode( "/
my:myFields/my:group10/
my:cbIdentifyAssetFilterTypes",this.NamespaceManager );

if(connection.Command.Contains("inner join"))
{
//i want to remove the inner join text if there is already an inner //
join so that i can append the new join condition.
int index = connection.Command.IndexOf( "inner" );
connection.Command = connection.Command.Remove(index );
}
// Generate the new SQL statement with the INNER JOIN and WHERE clause
string strSQL = connection.Command + " inner join
linker_parent_to_child_nav l on l.childid = NavigationGroups.id where
parentid = '" + node.InnerXml + "'";

connection.Command = strSQL;

this.DataConnections["NavigationGroups"].Execute( );

}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.