Pre-Populating A Repeating Field Upon First Use - InfoPath Dev
in

InfoPath Dev

Pre-Populating A Repeating Field Upon First Use

Last post 07-17-2010 07:19 AM by Skarn. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-10-2010 09:25 AM

    Pre-Populating A Repeating Field Upon First Use

     First of all, I wanted to say that these forums have helped me immensely in the past and I wanted to thank you all.

    I'm currently working on an annual building safety inspection form that uses multiple SharePoint lists as secondary data sources.  The primary purpose of the form is to allow an inspector to choose some basic "myHeader" drop-downs, such as building type/number, and then provide them with relevant questions, allowing the inspector to review the citations associated with that question and document their findings.  The form will also allow the inspector to view historical information and continue to add findings to existing documents.  I have no problem pulling in the information from the secondary data sources, but I do have an issue documenting the associated findings for each question.  I'm planning to submit the form to a form library so I don't need to actually store any of the secondary data inside my form.

    My proposed solution is to populate a repeating "myQuestionID" field in my primary data source with the numbers 1-1000, enabling a unique association with all of the almost 1000 questions in the question list.  This action will only be performed the first time a new form loads for a building to ensure that all relevant questions are populated on the form.  The myQuestionID will be part of a repeating section that will contain the following:

    • Expression Box containing Question associated with myQuestionID
    • Expression Box containing Citations associated with myQuestionID
    • Repeat Table Containing:
      • Findings Field
      • Finding Date
      • Inspector
      • Other Ancillary Data....


    Essentially, this myQuestionID field will allow me to query secondary data sources and record inspector responses.  As a side note, I'm currently using InfoPath 2003 due to the glacial pace at which the government updates their software.  We're planning to get InfoPath 2007 next month but I'm trying to work with what I currently have.  I know that this is a lot of background information but I wanted to try to share my rationale for approaching the problem in this manor.  Please feel free to let me know if my approach is off or if you have any suggestions.  Any help would be greatly appreciated because I'm running out of ways to approach this problem.

    Thanks,
    --Scott

  • 02-12-2010 12:46 AM In reply to

    Re: Pre-Populating A Repeating Field Upon First Use

    Hi Scott,

    You should consider using two form templates of matching schemas. One form is used to generate the "default values" for the other one. So that when they double click a form saved from XSN #1 it opens up a form of XSN #2 with prefilled questions. In other words, the questions are data-driven. I can show you an example of the concept. We have done this kind of thing many times. Let me know if you want a demo. Getting the schema correct is the most important thing.

    Patrick Halstead
    Project Manager at Qdabra
  • 02-12-2010 05:26 AM In reply to

    Re: Pre-Populating A Repeating Field Upon First Use

     I would really appreciate any examples you could provide.

     Thanks,

    --Scott

  • 02-17-2010 10:16 AM In reply to

    Re: Pre-Populating A Repeating Field Upon First Use

    Well I've now worked around this particular problem in a not so elegant way, but at least it works. My solution was to create a secondary view that contained the repeating question section. In this section I have a field that has the following default value:

    count(preceding-sibling::*/IDGenerator) + 1

    This field only works correctly when the "Update this value when the results..." check box is marked for some reason so I can't rely on this field staying static. I created another secondary ID field which is set to update once and effectively stores the sequential question ID the first time the form loads.

    My next step was to change the "Default Value" of the question section from 1 to 1000. This was the painful part....manually adding 999 additional questions.

    When the user opens the form, they are prompted to populate some initial dropdowns and then are presented with relevant questions. Something odd I noticed was that by using Conditional Formatting to hide irrelevant questions, the content of the legitimate questions would occasionally become corrupt and display incorrectly. The way I solved this was to create a section inside of the repeating section and have it do the Conditional Formatting instead of the repeating section. I have no idea why this works but it seems to have done the job.

    My next problem at the moment is displaying and filtering references from a secondary data source inside of each question section. My post with the details can be found a the below link so if you have any suggestions I would really appreciate it.

    http://www.infopathdev.com/forums/t/14581.aspx

  • 04-08-2010 02:56 PM In reply to

    Re: Pre-Populating A Repeating Field Upon First Use

    Patrick - This concept sounds like it is something that I can use as well. I my case, I am trying to poll responses from managers - the challenge for me is each manager is responsible for one or more "topics" (for lack of a better word) and needs to complete a series of questions for each "topic".  Imagine a table with topics across the top and questions on the side.  The questions are static, however the number of topics vary by manager and all topics are unique across the entire population.  Ideally, each manager would open the form and see several repeating sections listing their topics - each section would have several pre-populated, protected,  text fields related to the topic, followed by a set of questions and related input fields.  For example:

    __________________________

    Manager: John Wayne 

    --repeating section--

    Topic ID: T-001 <prepopulated from data source>

    Topic Description: __This is Topic #1__ <pre-populated from data source - tied to Topic ID>

    Question 1:  Is this topic interesting ?: _________ <blank, pending response from JW (user) >

    Question 2:  Why did you choose this topic?: _________ <blank, pending response from JW (user) >

    ---

    Topic ID: T-002 <prepopulated from data source>

    Topic Description: __This is Topic #2__ <pre-populated from data source - tied to Topic ID>

    Question 1:  Is this topic interesting ?: _________ <blank, pending response from JW (user) >

    Question 2:  Why did you choose this topic?: _________ <blank, pending response from JW (user) >

    ... and so on... 

    --end repeating section--

    Is this possible?

  • 07-17-2010 07:19 AM In reply to

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

    Re: Pre-Populating A Repeating Field Upon First Use

    I've built a 'custom questionairre' form template which may do what you want. I'll get it from work next week and post it.

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