Concatenating Data from a Repeating Field which references a Data Source - InfoPath Dev
in

InfoPath Dev

Concatenating Data from a Repeating Field which references a Data Source

Last post 07-16-2012 06:00 AM by EpicQQs. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-12-2012 11:22 AM

    Concatenating Data from a Repeating Field which references a Data Source

    Hello all,

    I checked everywhere before making this post, and I have found a lot of options for double eval statements, but they are not meeting my needs.

    My setup is like the below screenshot, I want to use 'evalAccessRights' to capture and concatenate the input from 'accessRights', which is my Multiple Selection List Box.



    accessRights is my Multiple Selection List Box, which is pulling filtered values from a master SharePoint List.

    When the workLocation selected matches the Location in the SharePoint list, it will change the available checkboxes in the accessRights Multiple Selection List Box.  This is where I need your help.  I am looking for a double eval function that will cycle through accessRights, separating the concatenated data with a delimiter like ';' or ','.

    Formula placed into the 'evalAccessRights' field: 
    xdMath:Eval(xdMath:Eval(../my:accessRights, 'concat(., substring(";", 1, string-length(.)), " ")'), "..")

    The above function would normally work if I was using manually entered choices... but the data connection or filtering seems to be messing with it.

    Please let me know if you need anything else.

    Thanks,

    David

  • 07-12-2012 12:33 PM In reply to

    Re: Concatenating Data from a Repeating Field which references a Data Source

    Have you tried placing a rule on accessRights to set evalAccessRights to the value of that formula?  My experience is that you need to use a default value formula and a rule when you're working with double eval and a MSLB.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-12-2012 12:57 PM In reply to

    Re: Concatenating Data from a Repeating Field which references a Data Source

    Jimmy, thanks for helping me think outside the box on this one (literally!).  I did what you said but came across a problem, if I unchecked the boxes it didn't remove their values from the string.

    However, I found that by setting this field on submit instead of trying to build the string as the user input data into the field, it was constructed correctly.

    Solution was to make the evalAccessRights field blank, with no default value, and use a rule on the submit button to apply the function to the field.

    You have really helped me out, thanks!

  • 07-13-2012 11:50 AM In reply to

    Re: Concatenating Data from a Repeating Field which references a Data Source

    Alright, I'm almost there Jimmy - you fixed my original problem above... there is one remaining feature that I am trying to solve.  The datasource I am pulling from in SharePoint is a List that contains the fields 'Name', 'Category', 'Location' and 'Door Owner'.

    When a user selects a value (one of the Names, i.e. Office Only, FFO Specific, or IDF) from my MSLB, I would like InfoPath to pull the Door Owner from that location and store it into a text box (called 'Door Owners_IP').  I figure I will probably have to do this on submit, because otherwise the eval function seems to get confused if a user checks and unchecks boxes or changes their mind.

    Ideally though, I would select 'Office Only' and it would stick 'N/A' into the text box.  Then I could pick 'FFO Specific' and it would stick 'Brian' into the text box as well so it would look like this:

    Door Owners_IP:
    N/A; Brian; Luke;

    After realizing that I can only pull (I believe) one value at a time into the MSLB from SharePoint, it seems pretty tough... thanks in advance for any help you can provide.

    Regards,


    David

  • 07-16-2012 06:00 AM In reply to

    Re: Concatenating Data from a Repeating Field which references a Data Source

    I was able to do this!

    I used the following as a set field to current item rule on the MSLB control.

    xdMath:Eval(xdMath:Eval(xdXDocument:GetDOM("Master Data List")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Door_x0020_Owner[(../d:Title = xdXDocument:get-DOM()/my:myFields/my:repeatingSection/my:accessRights) and (../d:Location = xdXDocument:get-DOM()/my:myFields/my:SponsorDetails/my:workLocation) and (../d:Category = "Access")], 'concat(., substring(";", 1, string-length(.)), " ")'), "..")

    I'm going to test this out on submit and see if it is accurate, but it looks good so far!

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