Monday 31 October 2011

Filtering the InfoPath 2010 Multiple-Selection List Box

So you want to have a Multiple Selection List Box on a form that displays values from a secondary data-source but want to store the value ids within the main data source. No problem.

Now just the selected values need to be displayed. Just filter the main data source values with a lookup right – wrong! This is not compatible with InfoPath Form Services. In order to achieve this you must add the secondary data source as a repeating section. Add a calculated field within this for the display value with conditional formatting to only display the values that occur within the main data source. This works !?

image

To check that the ID is within the main data source: Count how many nodes exist within the main data source exist with the same ID as the one being displayed, if it is less than one then don’t display i.e.

count(xdXDocument:get-DOM()/my:myForm/my:MainList/my:mainItems[. = current()/d:ID]) < 1

No comments:

Post a Comment