Pass parameter to InfoPath

V

vb6dev2003

Hi,

I have a small VB program with a list of employees. When I click on one
employee, I would like the employee ID to be passed to InfoPath (which I
call during the click) in order to feed the ID as a parameter to a Web
Service (second data source in my IP form). At this point, I have no XML
file yet. I just want to pre-populate a few fields (name, age, etc.) based
on the ID.
What's the best way to do this? Looks like it should be simple..but can't
figure it out.

Thanks

vbdev
 
A

Alexander Prozor

you can get DOM of XDocument ( after registering of solution ).
find elements ( fields ) that you willing to fill and set its values.
sorry, I can't give you a VB example.
you can get the main idea from this c# code:

infoPathApp.RegisterSolution(fileName, "overwrite");
infoPathApp.XDocuments.NewFromSolution(fileName);

XDocument document = infoPathApp.XDocuments[infoPathApp.XDocuments.Count
-1];

foreach(System.Data.DataColumn column in _ProcessContext.Tables[0].Columns)
{
string fieldName = column.Caption;
node = infopathDOMDocument.selectSingleNode ("//my:"+fieldName);
if(node != null)
{
string fieldValue =
_ProcessContext.Tables[0].Rows[0][fieldName].ToString();
node.text = fieldValue;
}
}
 
V

vb6dev2003

Thanks
vbdev

Alexander Prozor said:
you can get DOM of XDocument ( after registering of solution ).
find elements ( fields ) that you willing to fill and set its values.
sorry, I can't give you a VB example.
you can get the main idea from this c# code:

infoPathApp.RegisterSolution(fileName, "overwrite");
infoPathApp.XDocuments.NewFromSolution(fileName);

XDocument document = infoPathApp.XDocuments[infoPathApp.XDocuments.Count
-1];

foreach(System.Data.DataColumn column in _ProcessContext.Tables[0].Columns)
{
string fieldName = column.Caption;
node = infopathDOMDocument.selectSingleNode ("//my:"+fieldName);
if(node != null)
{
string fieldValue =
_ProcessContext.Tables[0].Rows[0][fieldName].ToString();
node.text = fieldValue;
}
}


Hi,

I have a small VB program with a list of employees. When I click on one
employee, I would like the employee ID to be passed to InfoPath (which I
call during the click) in order to feed the ID as a parameter to a Web
Service (second data source in my IP form). At this point, I have no XML
file yet. I just want to pre-populate a few fields (name, age, etc.) based
on the ID.
What's the best way to do this? Looks like it should be simple..but can't
figure it out.

Thanks

vbdev
 

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