Insert Data from Repeating table into Separate Single Textbox - InfoPath Dev
in

InfoPath Dev

Insert Data from Repeating table into Separate Single Textbox

Last post 09-08-2010 08:25 AM by ncarson. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-24-2009 07:57 PM

    Insert Data from Repeating table into Separate Single Textbox

    Hi Everyone!  First time posting so I hope I can explain myself properly.

    I want to take all of the data (Email addresses) from multiple rows of a repeating table, and insert them into a separate single textbox so that I can pass this data through to a workflow.

    I found this page: http://blogs.msdn.com/infopath/archive/2006/04/05/569338.aspx and I had a small amount of success.  I have a basic understanding of how the code works but not enough of an understanding to make it work for me.

    The end result I want is that inside my field "EmailContactMerge" I want to have the data: "[email protected]; [email protected]; [email protected];".  This data represents 3 rows from the repeating table "ContactEmailGroup" from the original source "ContactEmail".

    My Form is browser compatible, and I do need this to work in a browser.

    My Data Source looks like this:

    myFields
      JobRequestPage (Group)
        EmailContactMerge (Field)
    Email (Group)
      ContactEmailGroup (Repeating Group/Table)
        ContactEmail (Field)

    The value I have put into "EmailContactMerge" field is as follows: eval(eval(ContactEmailGroup, 'concat(../../my:Email/my:ContactEmailGroup/my:ContactEmail, "; ")'), "..")

    The result is that data will be separated by a ";", but all I get is the data from the first row repeated for as many rows that exists in the repeating table.

    For example, the data in the repeating table looks like this:

    row 1: [email protected]
    row2: [email protected]
    row3 :[email protected]

    The date that appears in "EmailContactMerge" where the code resides is: "[email protected]; [email protected]; [email protected]"

    Can someone please fix this code for me so that it will display the data from all rows instead of just the first one?

    Thanks in advance.

  • 06-24-2009 08:29 PM In reply to

    Re: Insert Data from Repeating table into Separate Single Textbox

    Here it is:

    eval(eval(ContactEmailGroup, "concat(my:ContactEmail, ';')"), "..")

    It's because you used the GUI to select the ContactEmail node, but that's a different Xpath than what the Blog shows.  Notice how Person is a resolved field name, but my:Email is straight Xpath.  You have to actually type it in, and it works like a charm.

  • 06-24-2009 08:37 PM In reply to

    Re: Insert Data from Repeating table into Separate Single Textbox

     That is bloody Brilliant!

     The article http://blogs.msdn.com/infopath/archive/2006/04/05/569338.aspx did say I had to type it in by hand, but I just couldn't type in the right thing.

     Thanks heaps :)

  • 09-08-2010 08:25 AM In reply to

    Re: Insert Data from Repeating table into Separate Single Textbox

    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?

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.