Prepopulate a column in a repeating table with 50+ rows - InfoPath Dev
in

InfoPath Dev

Prepopulate a column in a repeating table with 50+ rows

Last post 10-26-2016 02:21 PM by mike_tower. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-24-2016 07:47 AM

    Prepopulate a column in a repeating table with 50+ rows

    I spent two or three days researching all over the internet how to do this and I still haven't figured it out. Let me try to explain what I have to work with.

    I am trying to make a form that a user will fill out and will submit data to two of three tables. The tables are: REVIEWS, QUESTIONS, ANSWERS.  The general information for the form (e.g. date, username, category, etc.) will be submitted to the REVIEWS table with a unique REVIEW_ID. The responses to the questions (the majority of the data) will be submitted to the ANSWERS table and will all have the same REVIEW_ID. Instead of submitting this to the database directly I decided to save it all to an XML file. I'll then have a separate program grab the data and split it into the two different tables. So far so good.

    The questions asked in each review are dynamic. They will change over time and are specific to each review category. For each category there are 50+ questions. I need to pull the QUESTION_ID and QUESTION_TEXT into the form when a category is selected from a drop down. No problem. I can do that with a repeating section. Here comes the problem. I then need a repeating table with the same number of lines as questions and each answer line needs to contain the corresponding QUESTION_ID. So, the data submitted to the ANSWERS database would be QUESTION_ID (to link the answer to the correct question), RESPONSE (multiple choice: Yes, No, N/A), and COMMENT (long text).

     I found this forum topic that worked perfectly for fewer than 16 lines: http://www.infopathdev.com/forums/p/29457/100844.aspx

    The issues doing it that way were 1) I couldn't use it for the 50+ questions and 2) it took a really long time to load for anything more than about 10 lines.

     Any ideas on how to do this? I just need to pull in 50+ lines from a secondary source and use the ID in each line in a repeating table for submission. I am doing this on a work computer meaning I do not have the ability to install plugins, extensions, etc. Also, I do not have Visual Studio to write code. Thanks in advance!

     

  • 10-24-2016 04:03 PM In reply to

    Re: Prepopulate a column in a repeating table with 50+ rows

     Hi - the only way I know of to do this without code is to use default data, like the post you mention, but I found the same issue in the browser if using default values for this. I changed to using rules instead and didn't run into errors / limits - and this is with a test form published to Office 365. Save the attached sample locally, right click and select design. Rules are on form load and set node - I'm populating two fields with data from a secondary XML and then have a third field in the table just so you can see that if you select something and save the file & re-open it stays selected. The nice thing about this approach is in my form load rules, I'd only populate the data when a new form is opened, so I don't update from the secondary data file when the form has been filled out by users already.

    Hilary Stoupa

  • 10-25-2016 08:56 AM In reply to

    Re: Prepopulate a column in a repeating table with 50+ rows

    You are a genius. I hope you're getting paid for this! It works perfectly. I was able to manipulate your template to work with my data sources.

    I do have a question about xPath I hope someone can help me with. What I'm trying to do is filter the results in the table based on a dropdown at the top of the form and another static text string.

    Using this everything works fine if I want every row of my data displayed:
    xdXDocument:GetDOM("QUESTIONS")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[count(current()/../preceding-sibling::my:group2) + 1]/d:QUESTION_ID

    I'm trying to get this to work so I can filter my results:
    xdXDocument:GetDOM("QUESTIONS")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[count(current()/../preceding-sibling::my:group2) + 1 and d:FORM = xdXDocument:get-DOM()/my:myFields/my:FORM and d:SECTION = "CS"]/d:QUESTION_ID

     When I use that xPath I am able to filter the data, but I'm only getting the first line. It won't give me more than 1 row. What am I doing wrong?

     

    P.S.

    I should point out that I changed the rule to run on dropdown value change instead of on form load.

  • 10-25-2016 09:18 AM In reply to

    Re: Prepopulate a column in a repeating table with 50+ rows

     It is fine to run the rule on a field instead of on form load.... I think the issue is with your filter. I think you need to have the filter first return all nodes that match your condition, then get the right index - so maybe something like this:

    xdXDocument:GetDOM("QUESTIONS")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[d:FORM = xdXDocument:get-DOM()/my:myFields/my:FORM and d:SECTION = "CS"][count(current()/../preceding-sibling::my:group2) + 1]/d:QUESTION_ID 

    Hilary Stoupa

  • 10-26-2016 02:21 PM In reply to

    Re: Prepopulate a column in a repeating table with 50+ rows

     Thank you again! I got it working and everything is running smooth. I really appreciate all of your help!

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