Hi Friends,
I got a textbox, a listbox and a button in an InfoPath 2007 form. The user
enters his ID in the textbox and clicks the button. I need to fetch all the
subjects, he has enrolled for, from a database table and populate the
listbox with the data one by one.
Obviously the query will be a parameterized query based on the ID that is
entered in the textbox. How to do this..?
Any suggestions are welcome...
Cheers,
Dibs
Clay Fox - 19 Sep 2007 06:50 GMT
There are a couple ways to do this.
You can add a secondary data connection to your form that will retrieve all
of the data in the table and you can filter it to display just the
information you want. However there is a performance issue since you cannot
truly query the table with a direct connection to the DB.
You can create a database form from scratch which will allow you to query
and submit to one table but this may not be what you are really looking for
since the data is not the primary.
Use webservices such as those available in the Database Accelerator which
gives you the ability to query and submit to multiple tables along with a lot
of other features such as Active Directory information to ID the Form user.
http://www.qdabra.com

Signature
Thanks
Clay Fox
Qdabra Software
http://www.qdabra.com
InfoPathDev.Com
The Largest InfoPath Forum in the World
http://www.infopathdev.com
> Hi Friends,
>
[quoted text clipped - 9 lines]
> Cheers,
> Dibs
Dibs - 19 Sep 2007 07:34 GMT
Thanks for the reply Clay...
I could have done that but I also have to do some custom processing of the
data that is returned from the database which is only possible through code
i.e in the button click event in the VSTA. So, the steps I need to follow
will be...
1. Fetch the data from the database
2. Filter the data based on the parameter
3. Apply some custom processing and calculation
4. Add the data to the listbox. The list box can be replaced by a repeating
table.
What I can't figure out is step 4. I can set a text box's value from code
using :
xNavMain.SelectSingleNode("/my:myFields/my:txtBox",
this.NamespaceManager).SetValue(string);
But I can't set values for a list box from code...
Will you be able to help me out..? It will be a browser-enabled form...
> There are a couple ways to do this.
>
[quoted text clipped - 25 lines]
> > Cheers,
> > Dibs
S.Y.M. Wong-A-Ton - 20 Sep 2007 01:46 GMT
A list box works on the same way as a drop-down list box. What you have to do
is bind it to a repeating group, either in your main data source or a
secondary data source, and then add child nodes to the group using
AppendChild(). The group will be filled with the items and they will then
appear in your list.
There are many approaches possible to this issue. I once wrote an article to
fill a drop-down list box
(http://enterprise-solutions.swits.net/infopath2007/programmatically-fill-populat
e-drop-down-list-box-infopath-2007.htm).
The concept to fill a list box is the same.
---
S.Y.M. Wong-A-Ton
> Hi Friends,
>
[quoted text clipped - 9 lines]
> Cheers,
> Dibs