April 2006 - Posts

Howdy everyone who attended my presso this afternoon, appologies for the final demo not working.

As promised here are the links that were mentioned.

InfoPath Tool Kit for Visual Studio 2003

InfoPath SDK

I don't currenlty have anywhere to host the code samples or power point but I'm happy to email it through just drop me a message

Update to the comment above, I now have a site to host this code, you can find both the sample code and the power point slides here

This is a question I have seen come up on the newsgroups a couple of times now so I figured it may be worth putting up a post to illustrate how to do this.

The basic principal is pretty simple the values in one combo box are determined based on a selection from a previous combo box

The first combo box will contain a list of authors, the second will contain a list of books written by the author selected in the first combo box

 

So now we know what we are trying to achieve it's time to look at how we actually do it. In this example both the Author and Book data is being sourced from the forms XML structure, there is however no reason why this data could not come from a web service, database or external xml file.

So our first step is to map our the list of Authors in  our form to our first Combo box

The second step is to map data to our second combo box with a filter based on the value selected in the first combo box

once the data that is being displayed has been selected we then need to create a filter to make sure that only the books that were written by the selected author are displayed. To begin click the "Filter" button then click the Add button to add a new filter rule

This filter rule states that only the books that have the same Author as was selected in the "AuthorSelected" combo (Combo1) will be displayed.

 

This approach is a good way to ensure that the user selects only a valid combination of values when entering data. There is also no reason why this approach could not be cascaded more than once to create a more detailed hirearchy e.g. Year>Author>Book.

Happy coding!