I have a similar problem that I can't seem to get to work and hope someone can help me. I have a Repeating Table and I want the row contents concatenated and separated by a comma but not have a comma at the end of the string. My datasource is set up like this:
Main
myFields
EventPage (Folder)
EventInfo (Folder)
LawyerRoles (Folder)
SpkrsGrp (Folder)
SpeakersGroup (REPEATING GROUP)
LawyersSpeaking (TEXT FIELD)
xPath properties of Repeating Group: /my:myFields/my:EventPage/my:EventInfo/my:LawyerRoles/my:SpkrsGrp/my:SpeakersGroup
xPath properties of Text Field: /my:myFields/my:EventPage/my:EventInfo/my:LawyerRoles/my:SpkrsGrp/my:SpeakersGroup/my:LawyersSpeaking
The Text Field (Lawyers Speaking) is a Drop-Down List Box connected to an external data connection so a user can select from a dynamic database of names and there is no limit to the number that can be selected, but in most cases probably won't be more than 6-8 names.
I added a text box and for the Properties I inserted this formula:
substring(eval(eval(SpeakersGroup, 'concat(/my:myFields/my:EventPage/my:EventInfo/my:LawyerRoles/my:SpkrsGrp/my:SpeakersGroup/my:LawyersSpeaking, ", ")'), ".."), 1, string-length(eval(eval(SpeakersGroup, 'concat(/my:myFields/my:EventPage/my:EventInfo/my:LawyerRoles/my:SpkrsGrp/my:SpeakersGroup/my:LawyersSpeaking, ", ")'), "..") - 2))
I know there's an extra closed paren at the end, but I kept getting an error asking for an "end of string" so after adding the last paren InfoPath accepted the formula without any errors.
Only thing is all the field gets from this is the first three characters of the first name selected. Can anyone help me with this?