Aggregation: and many became one...

In InfoPath 2003, forms were equipped to merge in a simple manner: repeating sections and tables would merge to form one, as would the contents of lists or rich text controls. The remainder of the form was not merged. This functionality proved useful for many scenarios, but there was much more that could be done. Unfortunately, the only way to do it was to write your own merge XSL. So, in InfoPath 2007, we’ve enabled options that allow you to customize a form’s merging behavior.

Merge settings are now available in most fields’ and controls’ Properties dialogs. For fields, you’ll find Merge Settings under the Rules and Merge tab. For controls, under the Advanced tab. The available options will differ based on the settings that are available for each type of field. Here’s an example of options available for repeating fields and groups:

Notice that you can select the order of the merged items as well as whether to combine entries based on a matching value.

Merge settings for rich text fields vary somewhat from the repeating group ones shown above:

One of the most useful options is being able to prefix each merged item with some value. For example, if you’re merging status reports from different members of your team, you may want to prefix each entry with the name of the person submitting the report. This’ll ensure that you can keep track of who said what. You can even add fancy formatting for your visual pleasure.

Changes to the OM

In the new InfoPath OM, you will see some changes with regards to merging: there is now only one merge event, called – surprise, surprise – Merge. In InfoPath 2003, there were two events: OnMergeRequest and OnAfterImport. The new Merge event has taken the place of the old OnMergeRequest event. We have chosen to deprecate OnAfterImport because there’s no real need for it: InfoPath code executes sequentially, so any code that would have been included in the OnAfterImport event can be placed directly after the XmlForm.Merge() call that actually performs the merge.

Using InfoPath 2007 to set merging on your InfoPath 2003 forms

Because InfoPath strives to achieve backwards compatibility, any form template you design in the InfoPath 2007 designer can be saved as an InfoPath 2003 form template. This will allow users that don’t have the newer version of InfoPath to fill out your form.

Even though the ability to specify how your form will merge is a new feature in InfoPath 2007, InfoPath 2003 already had the infrastructure in place to make it work. In fact, if you knew how to write the appropriate XSL stylesheet, you could have created all the specific merge functionality that is now permitted through the UI.

So, bottom line, all the fancy merging work that you do while designing your form in InfoPath 2007 will be respected when you save your form template as InfoPath 2003 and have users with InfoPath 2003 fill it out.

- Bojana
Program Manager