connecting two infopaths

S

swathi

Hi,

I have a question regarding connecting two infopaths.
How can we connect two infopaths through a common column?
I have an infopath with EMPNO1 and this infopath contains another file
attachment(infopath) and I have to popup the second infopath with the same
EMPNO1.
How can we do it?

Thanks in advance
 
K

Kalyan G Reddy MVP (GGK Tech)

Hello

This involves a complex workaround. You should write a code to get the value
on Onload when the second Infopath Form(Attachment) is opened. This Form will
read the first form and get the value.
 
S

swathi

so, where I have to write the code,
Tools -> Programming-> loading event

under Forms_Loading event.....
Is this right?
 
K

K.Ramana Reddy(GGK Tech)

Hi,

Yes, You need to wroite the code to in Load event to load the Infopath form
and then get the field value you want use.
 
S

swathi

How to write code for this task????

K.Ramana Reddy(GGK Tech) said:
Hi,

Yes, You need to wroite the code to in Load event to load the Infopath form
and then get the field value you want use.
 
S

swathi

I tried the following code.

try
{
string strCustID = e.InputParameters["CustID"];
DataSource dsCustomers = this.DataSources["GetCustID"];
XmlNamespaceManager ns = this.NamespaceManager;
XPathNavigator xnCustomer = dsCustomers.CreateNavigator();
XPathNavigator xnCustomer =
xnCustomer.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:Customers/tns:CustomerID");
xnCustomer.SetValue(CustomerID);
dsCustomer.QueryConnection.Execute();
}
catch (exception e)
{
MessageBox.Show(e.message,"Error");

}

but encountered the following error:

System.Collections.Generic.KeyNotFoundException was unhandled by user code
Message="The given key was not present in the dictionary."
Source="mscorlib"
StackTrace:
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at
Microsoft.Office.InfoPath.Internal.ReadOnlyDictionary`2.System.Collections.Generic.IDictionary<K,V>.get_Item(K key)
at customer_Checklist.FormCode.FormEvents_Loading(Object sender,
LoadingEventArgs e)
at
Microsoft.Office.InfoPath.Internal.FormEventsHost.OnLoad(DocReturnEvent
pEvent)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)

Is this the process for transferring the value of a field from one infopath
to another infopath.
Thanks in Advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top