Programmatically add values to a dropdown list

J

Julio Sarmiento

I am retrieving values from an AS400 system using a web service and I need to
add the dataset to the InfoPath dropdown list. So far I have tried to loop
through all the records returned and add them via the SetValue, InsertAfter
and InsertBefore. Can someone tell me how I can add a dataset to a dropdown
list?

Thank you in advance.
 
S

S.Y.M. Wong-A-Ton

You are on the right track. First you need to create a group node with a
repeating group (+field) under it and bind your drop-down list box to it.
Then you need to loop through your data and fill the repeating group with it.
 
J

Julio Sarmiento

Thanks for your reply but I do not follow. How will adding my data to a
repeating group be similiar to adding the data to the dropdown list? Can you
provide an example perhaps?
 
S

S.Y.M. Wong-A-Ton

The concept is difficult to understand at first, but try binding your
drop-down list box to a secondary data source, such as a database table and
it will become much clearer.

Once you bind your drop-down to a repeating group, the group will serve as
the provider for the items that will appear in your drop-down. So then you
can fill the drop-down by filling the group. Filling a group is just a matter
of adding XML child nodes to it in code. The actual field that represents
your drop-down on the InfoPath form holds the value you select from the
drop-down, and not the items themselves.
 

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