Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Summary
Suppose you want to have the items listed in a drop-down be dependent on the selection of another drop-down (this is also known as "cascading dropdowns). If you have InfoPath Service Pack 1 installed, you could use the "Filter Data..." feature to accomplish this.
Example
You have one drop down labeled "State: " with the names of states and another drop-down labeled "City: " which gets populated with the names of the cities for the state you selected on the previous drop down.
The city drop-down obtains its values from an xml file which might look something like this:
<Cities>
<City state="Washington">Redmond</City>
<City state="Washington">Seattle</City>
<City state="California">Los Angeles</City>
<City state="Florida">Orlando</City>
</Cities>
Implementation
Additional Notes/Tips
Anonymous
March 24, 2004
Is there a way to accomplish this without SP1?
Anonymous
March 24, 2004
I battled bravely with this for a while before cracking it with a secondary data source I created from an access database but when I tried to hook it up to the SQL server I lost the dependent dropdown values.
The connection works fine with both dropdowns populated with the full lists until I try to build the filter, then the dependent dropdown drops out.
Any ideas
Cheers
Luigi
Anonymous
March 24, 2004
From Lauraj's blog, I just read that the Infopath team has a blog. Great news. I didn't realize but then again I haven't been doing much blog related reading (or writing for that matter) for the past couple of weeks so I think it's time to catch up. Today's post is on one of my fave new things from the SP1 preview. Using filters on your dropdown boxes and secondary data sources....
Anonymous
April 13, 2004
To do this without SP1: lets say you have a query for the data adapter that you want to update based on the selection of another drop-down. What you want to do is write script such that on the change of the primary drop down, you update the query for the adapter you want to refill itself and then requery that adapter.
Anonymous
May 24, 2004
The comment has been removed
Anonymous
May 25, 2004
I also have the above problem.
Anonymous
October 15, 2006
For the two above comments: in InfoPath 2003, you need to employ an XPath current() function, described in this article:http://blogs.msdn.com/infopath/archive/2004/09/13/228881.aspxInfoPath 2007 will do this for you.Thanks,Alex
Anonymous
May 03, 2010
I have created an InfoPath form and have a specific field linked to another site via a data connection from where I collect a set of alphanumerical codes (ex: WTR001A, GDL542B). I want to semi filter the codes. I don’t want to sort them alphabetically for now, just worry about filtering the options upon selection of a specific building location.My 1st filter field asks the user to select a building location which are:• AMS = Americas• BA = Buenos Aires• BCN = Barcelona• Etc.Upon the user’s selection I want the “codes” mentioned above to display only the ones pertaining to that building location. Perhaps having a XML file that specifies if a user selects Barcelona, then only show BCNXXX “codes” if a user select Singapore, then only SGPXXX codes showWould an XML file work? If so how would it look like?
Anonymous
February 28, 2011
Thank you man that was a good article
Anonymous
December 06, 2011
how do I create the xml the city drop down obtain its values from?
Anonymous
December 27, 2012
I do this 'filter' and it returns only 1 row in the drop down, while it should return 4 or 5 different values in the dropdown.PS: using Infopath 2010.
Anonymous
April 01, 2015
The comment has been removed
Anonymous
April 09, 2015
If you are interested in learning advance use of drop down list with Conditional Formattingwww.exceltip.com/.../cascading-drop-down-list-using-conditional-formatting-in-microsoft-excel-2010.html
Anonymous
May 06, 2015
on the state property, if I add a rule to set City to empty, it does not change at all, the first few selected cities stays there forever.
Anonymous
May 13, 2015
Any way to get this to work from Excel?
Anonymous
August 17, 2015
Thank you, Thank you! Solved huge issue for me.
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in