Populate a checkbox based off of a SharePoint List - InfoPath Dev
in

InfoPath Dev

Populate a checkbox based off of a SharePoint List

Last post 09-16-2013 07:17 AM by Justin Koshy. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 09-11-2013 07:31 AM

    Populate a checkbox based off of a SharePoint List

    Hello, I am new to InfoPath (I'm using InfoPath 2010) and could really use some help. I am trying to populate a series of checkboxes on a form based on a SharePoint List.

    Users submit a report form on a monthly basis. Fields included on the form are the user's name, month, and year. The form is submitted to a SharePoint library that contains these monthly reports for all users.

    The checkboxes I wish to populate on the form are months in the year. The month checkbox should be checked if the user has submitted a form already for that month in the current year. So the month checkbox logic is the following:

    1. Find out all the reports submitted for the user looking at the form
    2. If the user has submitted a report for a month matching the month's checkbox, and the year matches the current year, check the month checkbox.

    I am stuck on how to apply this logic to InfoPath. Mainly, I do not know how to query the SharePoint library to find all the lists reported by the user looking at the form. Any help would be greatly appreciated!
  • 09-11-2013 12:10 PM In reply to

    Re: Populate a checkbox based off of a SharePoint List

    Hi - are you promoting the User's Name, Month and Year fields to your SharePoint library you submit the form's to? You'll want to do that first.

    Then, create a secondary data connection to that library. Be sure to include the User Name, Month and Year fields in the data connection. Toward the end of the data connection wizard, you'll have the option to decide if you want the data returned when the form opens - deselect that checkbox.

    Add a form open rule to set the Query field for the user name in the data connection you just created to the userName() function, and add another action to query the data source. You could also set the query field for year to the current year to get just this year's. That can be done with substring-before(today(), "-")

    This should return a list of the items the user has submitted to the library.

    From there, you can add rules to set the checkboxes or you can use default values for them that check to see if there is an item in the list with the correct Month name.

     

    Hilary Stoupa

  • 09-11-2013 02:09 PM In reply to

    Re: Populate a checkbox based off of a SharePoint List

    Hi Hilary,

    Thank you for the quick response!

    I set up the data connection to the library, but I do not know how to "set the Query field for the user name in the data connection you just created to the userName() function". Could you elaborate on this?
  • 09-11-2013 02:51 PM In reply to

    Re: Populate a checkbox based off of a SharePoint List

     Here's a link that may help - http://blogs.msdn.com/b/infopath/archive/2010/05/06/sharepoint-list-data-connections-in-infopath-2010.aspx

    I don't see images showing on that page, sadly. Here's another blog post that may help: http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=129

    Let me know if you need more info.

    Hilary Stoupa

  • 09-13-2013 07:11 AM In reply to

    Re: Populate a checkbox based off of a SharePoint List

    Thank you Hilary! I solved my issue with your help.
  • 09-16-2013 07:17 AM In reply to

    Re: Populate a checkbox based off of a SharePoint List

    Hi,

    I had a follow-up question. How can I set up picture controls to show a picture based on the condition that a secondary data source contains a certain value? The issue I have is that I need to filter/query the secondary data source first, so I can't set the condition directly on the picture control rule.

    The basic data structure again is that users submit a monthly report. On the form there should be twelve picture controls associated with the months of the year. These pictures will be displayed if the user has already submitted a report for that month (e.g. the January picture is displayed if the user has already submitted a January report).

    Currently, I have the filtered data coming into a multiple-selection list box. I tried using the "contains" function to see if the multiple-selection list box contains a certain month, but it does not appear to work. I tried using a nested eval function to concat the multiple-selection list box into a single text box so that I could the "contains" function, but the nested eval function that I am using only works if the multiple-selection list box entries are checked. And I could not find a way to set all the entries to be automatically checked. I feel like there is more direct way to approach this.

    Again, any help would be greatly appreciated!
    Filed under:
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.