Cascading drop-downs and images

Hi everyone!

You all know the great thing with InfoPath, how easy it is to work with cascading drop-downs. I would like to share one more thing with you in this area, how you could show different images depending on your choice in the drop-down.

I will very shortly describe how to set up cascading drop-downs, the main thing here is to give you the way to show the different images.

The drop-downs (2) is received from a SharePoint list with three columns “Tillverkare”, “Modell” and “Bild” (that is Manufacturer, Model and Picture, in english).

The configuration of the first drop-down looks like this.

The second drop-downs configuration looks like this.

Notice the lower circle, the next picture will show what to do when you press the button of the upper circle.

  1. Press the button to choose from your secondary data source
  2. A difference from the first drop-down is that you need to add a filter, so press the button “Filter data…”
  3. Add a filter where you say that Tillverkare (Main data source) is equal to Tillverkare (second data source)


Ok, so now lets move on to how to make this true for an image as well.

My list in SharePoint also has a third column called “Bild” (picture in english) and we want this picture to be changed depending on what Modell we choose.

Now lets add a Picture control to your form and open the properties of the picture.

You will see a default XPath to the picture control it self. Press the button to the right of the XPath and point to your secondary data source and your picture column. Now, as you see where the cross is, we would have wanted a button to add a filter, but it’s gone 😦

Instead we will use the filter from drop-down 2 as I will show you in a minute. For now, highlight your picture column in your data source and press OK. Also notice that you should set the picture to be Read only.

Open the properties of the second drop-down and copy the the part of the XPath that holds the filter.

[xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:Tillverkare = d:Tillverkare]

Add this at the end of the XPath for the picture control and replace “Tillverkare” with “Modell”. Now you have a filter for you picture control as well.

To avoid having to see the picture controls icon in the form when no “Modell” is choosen, put a formatting rule on it that has the condition “when Modell is blank” hide this control.

When you publish this form you will probobly get an error that looks like this.

But go ahead and publish anyway and you will see that it works.

For a full blog post about setting up the cascading drop-downs you should read this blog post at Koobar’s Point.

I hope this helps someone sometime…



Query and filter on related columns

Hi everyone!

I want to give you a way to filter a repeating table with the help of a drop down.


Let’s say you have a list with with a column called Requests and one column that is called Defects. You could have multiple defects for a request and now you only want to show thoose defects for the request you have choosen.


First add a data connection to receive these three columns from your list.

On your form, add a drop down and configure it like this.



Now add this secondary data source as a repeating table to your form and delete those columns you don’t need to show in the form. Deleting them from the form doesn’t mean that you delete them from the data source, they will still be there if you need them. Afterwards it could look like this.


Let us add the rule to the repeating table that will do the trick.

Highlight the repeating table and click the button Manage rules in the ribbon. Add a new Formatting rule that looks like this.

The condition says: When”Request” in the secondary data source “is not equal to” the “MainRequest” in the main data source.

Now when you test the form you will be able to see only those defects that belongs to the request you choose.