Sunday, February 16, 2014

InfoPath: Field Dependencies or Parent Child look ups

While collecting requirements for the new laptop deployment site I was asked if there was a way to allow different laptop model options other than the 4 standards we offer.
The idea was to allow each service line their own customized laptop options to prevent people from requesting laptops the service line does not have on hand or laptops they do not want their users to request.
The solution is to set up a set of dependencies that filter the information according to previous selections.
Let's start out with the list we want to submit:
Laptop Requests:
  1. Create a simple (requests) list with three columns all Single Line of Text entries
    1. User Name
    2. Region
    3. Service Lines
    4. Laptops
  2. Then create the secondary (Information) list where we will gather this information we want to have dependent on each other.
    1. Region
    2. Service Lines
    3. Laptops
Using Datasheet view, populate the information list with the dependencies. In this case it will have
  1. Regions:
    1. Asia
    2. Europe
    3. Americas
  2. Give each region at least two Service Lines
  3. Give each service line at least two Laptop options

Now we will attach these data points to the Requests List. This change can be made by customizing the list with InfoPath

The list should look like this:

Currently each of these fields are simple text and do not actually reference anything and can be filled out with anything. We want to bind them to the other list and its options:
Under the Data ribbon go to Data Connections
  1. Add a connection
  2. Create a new Connection to:
    1. Receive Data
  3. SharePoint Library or List

  4. Enter your site if not already there
  5. Find your secondary list (requests)

  6. Select the columns you want to bring over from the secondary List

  7. Leave the next two sections as default and then finish
Now we need to associate each field on the list with it's the column information from the secondary list
  1. Right click on the region box and under Change Controls select Drop-Down List Box

  2. Right Click again and select properties at the bottom.
  3. Select Get Choices from an External data source, under Data Source select the Data connection you made earlier (Information)

  4. Under the entries tree select region and then check the box that says Show only entries with unique display names

  5. This will now display the three region options on the form

Repeat steps 1-3 for Service Line
  1. However when you go to select the entries value you will add a step
    1. Once you select Service Line then you will select Filter Data below.
    2. Add
    3. In specify Filter Conditions
      1. Select Region in the first drop down
      2. is equal to in the middle drop down
      3. Choose Select in a field or group for the last drop down
        1. Change the field to Main
        2. Then chose the Region Field
        3. OK all sub menus until you are back in the original properties menu
  1. Select "Show only entries with unique display names"
Now the Service line is option cannot be selected unless the Region field is completed
And it will only show service lines that are under the region you selected.

This same process can be applied to the laptop options by selecting the service line under the filter options

No comments:

Post a Comment