Combining fields with formatted text in a repeating section - InfoPath Dev
in

InfoPath Dev

Combining fields with formatted text in a repeating section

Last post 12-06-2011 01:56 AM by merley72. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-22-2011 01:47 PM

    Combining fields with formatted text in a repeating section

    Hi,

    I've an InfoPath form on which there is a repeating section with two fields, one a drop-down list the second a multi-line text box.  When a user selects one of the options in the drop-down, I've a refresh which pulls back values from a related document, copying formatted text (often a series of sentences with line-breaks) into the multi-line text box.

    A user can then click on the repeating section button to add another pair of fields, and again they can choose from the drop-down list which populates the referenced text field.  We've now got 'two' formatted text fields with material in.

    What I'd like to be able to do is combine the values from 'all' of the text boxes into another field on the form using either a button / field rule or whatever and very importantly retain the text formatting.

    Anyone thoughts about how this might be completed in a 'no-code' fashion?

    Regards Alan C.

  • 11-29-2011 06:41 AM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    Re: Combining fields with formatted text in a repeating section

    You can combine repeating section fields in this way using a 'double eval' method.
    Here's my little 'recipe'

    xdMath:Eval(xdMath:Eval(<your repeating group>, 'concat(<field in repeating group to combine>,"<string or field to insert between on each combine>")'), "..")

    Here's an actual example where the repeating group is called 'repeatingGroup' and the field is called 'field1' and the string between each combine is ";"

    xdMath:Eval(xdMath:Eval(my:repeatingGroup, 'concat(my:field1, ";")'), "..")

    and attached is a sample form which demonstrates it working.

    Something of note is that you can't represent a carriage return in the above formula (ie what if I wanted to combine the fields with a carriage return between each one instead of a semi colon?).

    The workaround I've used in the attached sample is a trick using a secondary datasource XML file with a field containing the special characters for a carriage return in an XML file. Then I use that field as the <field to insert between on each combine> and this gives the desired result.

     

  • 11-30-2011 01:51 AM In reply to

    Re: Combining fields with formatted text in a repeating section

    Many thanks for the response. Sadly I can't download the example at work. I did fnd a couple of pages explaining the double eval work around but it didn't work the last time I tried it. I'll give it another go and let you know how I get on.

     Thanks again

    K

  • 11-30-2011 02:59 AM In reply to

    Re: Combining fields with formatted text in a repeating section

    Worked like a charm many thanks. The mistake I made last time was not enclosing the concat in ' '

  • 12-06-2011 01:56 AM In reply to

    Re: Combining fields with formatted text in a repeating section

    Thanks for the information and after a few mis-tries, I've got it working brilliantly!  The Carriage return in the XML file is a neat trick to be able to separate the sections as the concat won't allow for separation of field results nor the formatting to look reasonable.

    Thanks very much for your help over this one. 

    Alan C.

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