InfoPath 2010/2013: Concat repeating table fields into one field with delimiter

Expect that you will create a summary section of a repeating table. In this sample we want to get all first names of a repeating table and want to use a semicolon as delimiter. We will use a calculate value to store all this names into one field. The result looks like this:

We just need some xpath values to achieve this goal.

xdMath:Eval(xdMath:Eval(my:Persons/my:Person, ‘concat(my:FirstName, “;”)’), “..”)

Just add this xpath code to a calculated value and set your values. As delimiter we use ; and concat it with the field my:FirstName. To get all values and not only the first one we need the math function eval. That’s it.

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

About Dennis de Vries 34 Articles
Loving SharePoint, Social Media and like to work together with creative people all over the world.

16 Comments

  1. Hi

    Your formula work perfectly 🙂 Thank you!!!

    Is it possible to not show the last “;” though?

    Kind regards

  2. hi
    why my string returns ;;;;; ????
    without value of my field but when add row to repeating table then add “;” to my string?
    what is my problem?

  3. hi
    i want to cancat my fields in seperate line. is it possible that i use ENTER as delimiter??
    thanks

  4. Hi, i would not recommend this – it might be possible – but it depends on how things like ENTER is interpreted, e.g.
    or \n\r or whatever. It’s better to use something like “;” or “#”

  5. Hi, for the above example, how can I get a calculated value that will look like this (or the nearest):
    Dennis – 21
    Karsten – 20
    Guru – 99

    *where the numbers are their ages.

    Thanks a bunch.

  6. Hi,

    I’ve tried to implement this, but it looks like it’s just repeating the 1st Row of Data.

    Here’s my formula:
    xdMath:Eval(xdMath:Eval(../my:group7/my:group8, ‘concat(../../my:group7/my:group8/my:HardwareConsolidatedType, “;”)’), “..”)

    Does anything stand out?

    Kind Regards,
    Matt

  7. Hi, the calculated value works perfectly… problem is: how do I promote it to the SP list so I can see it as a column? Can’t seem to find a way…

  8. My text field does not populate with the value and I have tried various versions of the same eval formula.
    This is my current formula –
    eval(eval(Person, ‘concat(xdXDocument:GetDOM(“FIM Approvers”)/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Approver_x0020_Name/pc:Person/pc:AccountId, “;”)’), “..”)

    where Person – Repeating Group
    Account ID – to be concatenated based on the person populated in the repeating table

  9. For me this works for first record only . it always append same field. how can we do it for columns of same row ?

  10. how to concatenate values which have same country name, here for example, for “Germany”, records should get display : Dennis, Karsten.
    Is this is possible.
    please guide.

  11. Hi,

    I tried to implement this, but it looks like it’s just repeating the 1st Row of Data. and my my formula:

    xdMath:Eval(xdMath:Eval(../my:group2, ‘concat(../../my:group1/my:group2/my:ddlProject, “|”)’), “..”)

    Why?

  12. Hi,

    I tried to implement this, but it looks like it’s just repeating the 1st Row of Data. and my my formula:

    xdMath:Eval(xdMath:Eval(../my:group2, ‘concat(../../my:group1/my:group2/my:ddlProject, “|”)’), “..”)

    Why?

  13. This might help some people who read this later… This is what works for me in LIBRARY-based form. Create a text field and make the default value of it be:

    substring-after(eval(eval(Field1, ‘substring-after(concat(. = “”, “, “, .), “false”)’), “..”), “, “)

    Where “Field1” would be the field in your repeating table that you want to grab.

    If you run into any issues, try retyping in the quotation marks since sometimes they come over differently from other fonts compared to what InfoPath wants you to be using.

    This value will add a comma and a space between your items and then remove the last comma – for example:

    Apple, Banana, Orange

    If you have a LIST-based form, try this instead:

    substring-before(concat(eval(eval(Field1[. != “”], ‘concat(., “, “)’), “..”), “,”), “, ,”)

    I got this from another site at some point and saved it in my notes – there’s no way I could’ve ever come up with this on my own… 🙂

  14. hello, a help
    I have a repetitive table where I store the following fields “Code, name, date of entry, year, days of vacation”.
    how can I subtract the holiday days from this repetitive table, keeping in mind that those days are an accumulated one for years.

Leave a Reply