Concat fields in repeating table - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Concat fields in repeating table

Last post 09-18-2007 12:19 PM by swhiting. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 07-22-2005 03:58 PM

    Concat fields in repeating table

    Hey All,

    Is there a way to concatinate each field in a repeating table such as:

    repeatingtable1:
    -------------------
    [Field1]"This"
    [Field1]"is"
    [Field1]"a"
    [Field1]"test"
    wich would result in a field displaying "This is a test"?

    Thanks Guys!!!

  • 07-22-2005 06:05 PM In reply to

    Re: Concat fields in repeating table

    Hi WCOTech,
    Yes! This is easy. Just use the Concat function to calculate the value for the display field. Double click on the field that you want to display the concatenated string. Click on Fx button and then Insert Function. Select Text and then Concat. Click OK insert the fields as paramters. You'll have to play with it to get it to work with repeating fields, and there might be a challenge getting it to concat a variable length. Good luck!

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-25-2005 06:18 PM In reply to

    Re: Concat fields in repeating table

    Thanks for the response Patrick,
    I know that you can use the Concat function in to yield the following:
    repeating table
    ---------------
    [field1]="1" [field2]="2"

    concat([field1],[field2)

    Result: "12"

    But I want to concatinate all occurances of the same field together. I'm requesting this to be able to group a list of email addresses together to use for an email field.

    Thanks!
  • 07-25-2005 11:05 PM In reply to

    Re: Concat fields in repeating table

    Hiya,
    You might be able to do something sneakily recursive in XPath, but this really seems like a call for some simple code. Just an OnAfterChange loop with Concat ought to suffice. Recreate it every time. You could be clever and look for a way to just insert the new or delete the old, but that's too hard and won't yield much perf gains. Anyway, good luck on your coding.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 12-08-2005 02:51 AM In reply to

    • whapakk
    • Not Ranked
    • Joined on 09-23-2005
    • Philippines
    • Posts 22

    Re: Concat fields in repeating table

    Hi, 'been looking around the forum and I found this old thread... This is exactly what I am trying to do! But so far, the statement I managed to construct using rules only gets the first row. Is there an easy way of doing this through rules or do I really have to use looping with managed code/script. Thanks.

    Mike Olea
    InfoPathNoob
  • 12-08-2005 11:44 AM In reply to

    Re: Concat fields in repeating table

    With a repeating table of varying size this would be very hard to do with rules (if not impossible). The code would be really easy, check this out:

    function getEmails()
    {
    var list = XDocument.DOM.selectNodes( "//my:repeatingTable/my:email" );
    var str = "";

    while( node = list.nextNode() )
    {
    str += node.text + "; ";
    }

    return str;
    }


    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 12-11-2005 06:43 PM In reply to

    • whapakk
    • Not Ranked
    • Joined on 09-23-2005
    • Philippines
    • Posts 22

    Re: Concat fields in repeating table

    Ok. Guess I'll go with code then! Thanks Matt!

    Mike Olea
    InfoPathNoob
  • 06-26-2007 08:04 AM In reply to

    Re: Concat fields in repeating table

    hi!

    i got the same problem, but it seems my scripting skills are too poor to get this thing working. - how should the code be called? (onAfterChange ?)

    currently i got:

    function msoxd_my_packageTitle::OnBeforeChange(eventObj) {
       var list = XDocument.DOM.selectNodes( "//my:workPackages/my:section/my:packageTitle" ); // <- the repeating fields
       var str = "";
       while( node = list.nextNode() ) {
              str += node.text + "; "; }
       var target = XDocument.DOM.selectSingleNode( "//my:wpDescriptions" ); // <- the field where the condensed string should go
       target.text = str;
    }

    and i get the error:

    InfoPath cannot complete this action because of an error in the form's code.
    The following error occurred:

    InfoPath cannot update the data because the form is currently read-only.
    File:script.js
    Line: 35

     

    ... can somebody help me?

  • 06-26-2007 08:27 AM In reply to

    • romaik
    • Top 500 Contributor
    • Joined on 05-31-2007
    • Paris France
    • Posts 43

    Re: Concat fields in repeating table

    I cannot help you with that but my advice is :

    point which line is line 35 so that when the guys in USA will watch your question, they will not have to ask.

    And therefore, you might gain 1 day :) 

    InfoPath 2003 SP2 User
  • 06-26-2007 12:53 PM In reply to

    Re: Concat fields in repeating table

    This InfoPath Team blog post could be exactly what you are looking for:

    http://blogs.msdn.com/infopath/archive/2006/04/05/569338.aspx

    It's entitled "loops in formulas" :)

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-03-2007 05:27 AM In reply to

    Re: Concat fields in repeating table

    thank you! that worked just perfect.. :D
  • 09-18-2007 12:19 PM In reply to

    Re: Concat fields in repeating table

    This referenced blog solution works well for emails [  eval(eval(person, "concat(my:email, ';')"), "..")  ] but when you concatenate fields that are to be displayed on the form you're left with the separator (comma, semi-colon or whatever) at the end of the text.

    Is there a way to eliminate the last separator character?

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