This was, by far, one of the most
retarded [respectfully redacted per offended reader's request] painful (perhaps self-inflicted) things I have ever encountered in trying to work with InfoPath. Yes, there are quite a few posts on how to do what I was trying to do, but for some reason, none of them really resonated until I came across this post on MSDN. I don’t think I was able to find an exact description of what’s going on here, so I’ll do my best to document.
I have an InfoPath 2010 form that’s using an external data source (XML file stored in SharePoint). The repeating data structure looks like this:
|Level 1||Level 2||Level 3|
With that information, I’m trying to concatenate each instance of Email from each user into one string. Now, the commonly recommended formula for this type of action is this:
xdMath:Eval(xdMath:Eval(../my:RepeatingGroup, ‘concat(my:ValueField, “;”)’), “..”)
The problem with this formula in my case, is that for some reason, the value being returned would only show the concatenated value of the first node for the N number of nodes in the data source. For example, if my first email address is firstname.lastname@example.org and I had 10 other unique email addresses to concatenate, the result of the formula would look like this:
email@example.com; firstname.lastname@example.org; … etc. 10 times.
So after some days of head-banging and almost resorting to a code-based solution, the following formula fell out of the sky and works as expected:
xdMath:Eval(xdMath:Eval(xdXDocument:GetDOM(“NotificationRecipients”)/Users/User, ‘concat(Email, “;”)’), “..”)
The thing to note here is the Email field in the concatenation function. One would think you should use the “Insert Field or Group…” button to insert the field, right? Or at least have a path to the value or something…? Wrong… No pathing necessary and in fact, any pathing you put in here won’t even work. Well, it didn’t work for me… Just use the straight-up string literal node name.