Combining values from repeating section (with a multiselection list box) into one string - InfoPath Dev
in

InfoPath Dev

Combining values from repeating section (with a multiselection list box) into one string

Last post 04-21-2013 09:27 AM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-19-2013 11:42 PM

    • soebje
    • Not Ranked
    • Joined on 04-20-2013
    • Posts 1

    Combining values from repeating section (with a multiselection list box) into one string

     I have a form with af multiselection list box control inside a repeating section with the following structure.

    I would like to have the values from the repeating section parsed to at singlefield text field (for later parsing i a database)

    My fields structure looks like this

     


    Companies is my repeating section
    Name is a text field
    Description is a text field
    Roles is a repeating text field. Used in the form with af Multiselection list box

    So form can have multiple companies
    Each company has a name, description and multiple roles

    A need a rule that extracts the values of the companies repeating section and parse them into the field 'CompanyInfo' like this:
    CompanyAName#CompanyADescription#CompanyARole1Value|CompanyARole2Value;CompanyBName#CompanyBDescription#CompanyBRole1Value|CompanyBRole2Value,CompanyBRole3Value

    So repeating section are devided by semicolons. Fields within repeating section is devided by #. And values inside Roles is devided by |

    I have tried with different eval/concat combinations but can't quite get it working.

    So please help with this one and let me now if additional information is required

     

    Best regards

    Søren, DK

  • 04-21-2013 09:27 AM In reply to

    Re: Combining values from repeating section (with a multiselection list box) into one string

    Repeating fields are not a best practice because they are hard to map to separate database rows and can cause form logic to fail when accessing fields after the repeating one. 

    I recommend creating a group called Roles with another repeating group underneath it called Role and a field called Name inside of that. 

    Then, you can use a double eval technique to get your string. Something like this:

    substring(eval(eval(Role, 'concat(my:Name, " | ")'), ".."), 1, string-length(eval(eval(Role, 'concat(my:Name, " | ")'), "..")) - 2) 

    It's a wee bit tricky. We do cover this as part of our training class and I'd be happy to send you the training lab that walks you through the technique but first you have to fix your data source.

    :)

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.