Populating fields according to drop-down selection

S

Simon L

Hello,

I have an InfoPath form, which currently displays all data from a secondary
data source in a
repeating section.

I would like to get the form to display information, depending on a value
selected from a dropdown
list, and have followed this tutorial, 'Automatically Populate fields from a
drop-down selection'
at
http://www.infopathdev.com/howto/tutorials/default.aspx?i=9111ef580f95479890fc18fb2c5bac85
but it hasn't worked for me.

Any help would be greatly appreciated.
thanks,
Simon
 
S

S.Y.M. Wong-A-Ton

Ordinarily you would use a filter on the repeating section and set the
selected value from the drop-down equal to a value from one of the fields in
the repeating section which would then automatically filter the repeating
section and show only those records that satisfy the filter condition, but
since the data from your repeating section is coming from a secondary data
source, you won't have this filter option available to you.

What you can do is something like I did in this article:
http://enterprise-solutions.swits.n...election-secondary-data-source&c=infopath2003

The downside is that you'll have to add each field you want to display and
hook it up to the drop-down using rules and filters, which can be a hassle if
you have many fields you want to display.
 
S

Simon L

Thanks for your reply. In my case though, I'd like to select a company from a
drop-down list, and then display all invoices for that company, whereas your
example only allows one colour to be displayed for each fruit selected.
Would it be possible to do this?
thanks,
Simon
 
S

S.Y.M. Wong-A-Ton

If the invoices are in a database, you can bind your form to that database.
This will enable you to use the filter option (Properties dialog > Display
tab > Filter Data button) on a repeating table/section like I mentioned in my
previous post. This is the simplest (codeless) solution.

If you want to keep the data as coming from a secondary data source, you'll
have to resort to writing code to do the filtering for you and then populate
a group node in your Main data source in the OnAfterChange event for the
drop-down list box. You'll not only need to know how to write code, but also
how to use filters in XPath expressions. This may be a very challenging
solution to implement.
 

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