[InfoPath] How to filter data on IP web enabled
One of the famous pitfalls in InfoPath 2007 is thinking that it doesn't have the ability to filter while on web or incase of having web-enabled forms. The few coming line will explain this issue and why many fall into this confusion…
Scenario: if you enabled web compatibility in IP 2007 and try to do a lookup on a field from a data source, sometimes you need to filter the information you get from external data source…
Let's say you have the following data:
- Desktop Problems
- Hardware
- Software
- Network Problems
- network cables
- IP telephone
Filter: you want to filter the data you bind to your controls, let's say if you have two fields, you want to show in the first field Desktop Problems, the second field should show only hardware and software.
Problem: if you try and filter on a field and the web compatibilities, you will get the following message: "Filtering is not supported in browser –enabled form templates."
Workaround:
- Go to control you consider as primary field that it will be the filter key…in this case "MainDataSource.Category"
- Right click, properties and Add a rule on it ..
- The rule should have the following:
- Action: set a field's value
- Field: set the destination field where you want to filter your data. In this case "MainDataSource.SubCategories"
- Value: here you need to insert a field from the external data source such that the key field in your main data source is equal to the key field in the external data source. To do that do the following:
- Here is the tricky part.
- Click on the button (fx)…
- Click on insert a field or a group
- Choose the destination filed you want from the external data source. In this case "ExternalDataSource.SubCategories".
- Click on the "Filter Data".
- Click on Add
- You have the format: <<Value>> <<Comparison>> <<Value>>
- Choose: ExternalDataSource.KeyValue IsEqualTo MainDataSource.KeyValue
- In this case: ExternalDataSource.Category IsEqualTo MainDataSource.Category
- The click on "OK" Gazillion times. J
Go and Test…
Comments
Anonymous
June 20, 2007
Sorry, but this does not work. The values that are not from the top-category remain in the dropdownlist.Anonymous
July 25, 2007
The comment has been removedAnonymous
August 27, 2007
Actually, it works fine, for my context. It matches DOB field with an ID attribute, and populates a field nicely matching data. Nice one, Wael, thanks for taking the trouble to share this.Anonymous
August 27, 2007
Thanks all for your comments,,, the guys are right about the auto select the filter here doesn't narrow down the list as much as it do an auto-select from the listAnonymous
August 27, 2007
ok i think the problem that you are all facing is solved via web Services,,, so what can you do is actually, do a web service that:
- takes a parameter,
- Do Filtering
- return List by this you will solve the issue you are all talkiung about
Anonymous
October 16, 2008
Actually, this works wonderfully. And the filter works as expected. Works great for cascading dropdownlists inside repeating sections as well! In fact, this is the only solution I have found after 2 and 1/2 days digging around that actually solved my problem.Anonymous
October 16, 2008
Stacy, Am glad that worked for you :DAnonymous
October 29, 2008
The comment has been removedAnonymous
November 07, 2008
I have tried to apply this solution to a new form I am working on and cannot get it to work. For some reason I am only getting the first entry in the external data source being returned. I have a sharepoint list: Location Slot X1 10 X1 20 X1 30 Y1 AA Y1 BB When I use the above method to filter on Location to return all Slots, if I choose Location X1 I only get 10 returned. I need all matches returnee to the slot drop-down list. any suggestions?Anonymous
May 11, 2009
it is not working - can anyone send me a working files to deepminds@gmail.com thanksAnonymous
July 12, 2009
Hello sir , its a really nice technique to filtering data on web IP form !!! but i am not getting result !! i did all the steps three times but i m not able to see matches value !!! what should be the problem !!! can u please help me out !!! thanks & regards, Dipti ChhatrapatiAnonymous
May 12, 2010
I fully agree with Mike this solution only returns the first item in the data source. The logic of this entire solution states to set a value not filter the data source. So when you select a category it is only going to set the value of the second field not do anything to the data connection of the sub-category field. Sorry but this is not a good sollution.