Infopath Dropdown filtering based on lookup column values?

Shane Devenney picture Shane Devenney · Jun 18, 2014 · Viewed 11.8k times · Source

I have a problem with filtering a dropdown in Infopath. I have two lists in Sharepoint. In List A there is a column which lists Company names, in list B there is a column that lists Employees. The Company names from List A are used as a lookup in List B, so that each employee has an assigned company.

The problem arises when I need to implement filtering logic in Infopath. In infopath I have two dropdown lists that connect to each list and display all the values in those columns. I need to filter the employee based on the company selected in the first dropdown. However since the values on list B are lookup values I cannot do a straight comparsion of the two values.i have tried to filter on a couple of different fields but I can't figure out this logic. Is there a way to filter based on lookup values?

Answer

Taco_Buffet picture Taco_Buffet · Jun 19, 2014

You need to make sure you are filtering your Employee dropdown by the Company field.

Here is what I did to get things working.

Created two lists:
Company
field: Title

Employee
field: Title
field: lookup to Company:Title
-field name: CompanyLookup

InfoPath Data Connections
CompanyDS:
fields selected ID and Title
EmployeeDS:
fields selected Title, CompanyLookup, ID

InfoPath fields
Dropdown titled Company

  • Datasource: CompanyDS
  • Value: ID
  • Display name: Title

Dropdown titled Employee

  • Datasource: EmployeeDS
  • Value: Title
  • Display name: Title
  • Click the tree-view button on the Entries property
    • select the first folder under dataFields. Mine is title d:SharePointListItem_RW
      • Click the Filter Data... button
      • Click Add...
      • First dropdown select CompanyLookup, second dropdown: is equal to
      • Third dropdown pick Select a field or group. Change the Fields dropdown to Main, then select Company.

I'd post pics, but I'm lacking enough "rep" points.