Large Survey creation (50+ questions + option buttons), need help on method - InfoPath Dev
in

InfoPath Dev

Large Survey creation (50+ questions + option buttons), need help on method

Last post 11-09-2012 10:57 AM by Nancy Young. 26 replies.
Page 1 of 2 (27 items) 1 2 Next >
Sort Posts: Previous Next
  • 06-28-2012 12:52 PM

    Large Survey creation (50+ questions + option buttons), need help on method

    Hi,

    • Scenario

    With infopath 2010, I'm attempting to create a survey which contains about 50 questions, each questions to be answered by clicking one option button out of four.

    Survey will be submitted and collected via outlook.

    Very basic you would think but due to the amount of questions I found very tedious to type them one by one in the form template and generate 50 options button fields...

    Also while exporting the form in excel I'd like to have one row per question/answer and not everything lined up in one row .

    I have an XML file (created from excel) which contain all questions and preselected values for option button fields. I made it a secondary data.

    I created a repeating table of this secondary data which populate all questions and even preselect option button while filling up the form.

    User can change option button but I put all questions field read only.

    I have a submit button which send the form to an Email address.

    The form template was really easy to make but....

    (see form template attached)

    • Problem:

    Everything working fine but The repeating table returns only blank information once the form is submitted (ie no questions, no answer value). No data is stored in the form but I can visually see the answers when I receive the form??!! Why is the data no available?

    Pretty useless for a survey!!

    • Clue:

    Certainly something to do with the fact I cannot store secondary data in the form

    How can I get away without coding which is clearly out of my depth.

    • Method:

    - Shall I give up this method and go for the tedious one?

    - Can I easily pull the information from the secondary data and store it in the form (including user answer)?

    - Any method you would suggest?

    - Any already existing template I can use?

    Your help will be very much appreciated

    Regards,

    Olivier

  • 06-29-2012 09:27 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    Hi-

    Your main problem is that your repeating table is bound to your secondary data source. IP won't store those values when you save.

    Here's a copy of your original with a few tweaks. I've set the repeating table in the main data source to include 50 instances of the Question group by default. I've added some conditional formatting to hide instances with a blank Category. I've set Category, etc. to use default values from your secondary data source.

    Save the file locally, right click and select design to open in design mode - since I rebound your table, all your formatting is gone, sorry about that.

    Hilary Stoupa

  • 06-30-2012 04:15 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    How cool is that Hilary!! Smile [:)]

    It does exactly what I was looking for.

    The clever bit I suppose is that formula you used to pull the data from secondary table, awesome! Don't have a full grip on that one put got the principle at least.

    Like the rule to hide empty row, sweet!

    How did you set the number of instances of the repeating table to 50? Don't know where to adjust it...

    Is it possible to change it to the size of the 2nd data repeating table to be neat?

    Thanks again for your help.

    Olivier

  • 07-02-2012 08:56 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    Under Data --> Default Values (Tools --> Default Values in IP 2007). You can add instances there. Of course, I'm far too lazy for that, so I saved your form as source files and modified the template.xml file to include multiple instances of the Question node - that way I could copy / paste instead of all the fidgety mouse clicking. :-)

    As to the formulas - basically, I'm selecting the same instance of the 2ds that my main DS is on - the count preceding-sibling formula gets me the numbers of questions prior to this one in the main data source - add one and I have the index I need to get the question data from the 2ds.

    Hilary Stoupa

  • 07-04-2012 06:13 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    Hilary,

    To make the most of your explanation above, I have tried to reproduce from scratch the same formula you came up with... unsuccessfuly :-(

    For instance you created Question[count(current()/../preceding-sibling::Question)+1]/Category

    Would you mind to walk me through the steps on how to build this formula? 

    I did try by Inserting "Question" and "Category" fields, then typing text between, but everytime I end up with an error in the formula.

    I noticed your formula is entirely underlined while mine only underline the fields I inserted. Something is definitively wrong. What does it mean?

    Thanks again in advance if you could unlock this piece of knowledge for me!!

    Regards,

    Olivier

     

  • 07-05-2012 10:04 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    Well, first I select the "Edit Xpath" checkbox in the formula editor - do that with my formulas, so you can see the full path - the part I entered by hand is just the filter between the "[" and the "]".

    So, I typed in the count formula - current() is the node I'm currently on. .. takes me up the node tree a step. preceding-sibling::my:Question gets me all the Question nodes before the one I'm at currently. I count them, add one and that returns a number - basically, the same number as the index of the Question node I am currenty on. Does that help?

    Hilary Stoupa

  • 07-11-2012 07:33 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    Ok, I have done what you said and it works fine (I just played a bit with the formula) but I soon as I replace the data source by a slightly different one and try to rewrite the formula I noticed it does change the namespace of the second data source when I insert the fields:

    Your formula:  

    xdXDocument:GetDOM("CAD Survey Excel Questions Data")/my:CADSurvey/my:Questionnaire/my:Question

    My new formula:

    xdXDocument:GetDOM("CAD Survey Excel Questions Data")/ns1:CADSurvey/ns1:Questionnaire/ns1:Question

    then the formula become erroneous! That namespace seems to be the cause of the problem...

    Why is the original data source referred by "my" and when I add a different data source it is referred by "ns1" ?

    How can I change it back to "my" as in the original example?

    Regards,

    Olivier

     

     

  • 11-06-2012 03:09 PM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    Hilary, I'm trying to recreate this and I keep getting an error that says that preceding-sibling::ns1:Point does not belong ot a valid locaiton path of a field or group.  So could you please break it down for me or tell me what I'm doing wrong:

    1. create an xml data source  (looks like this:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ns1:TTR_Update_Questions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-06-16T06:29:12" >
     <ns1:Question>
       <ns1:Point>A single training/conference event can be added to the form with ease</ns1:Point>
       <ns1:optYN>1</ns1:optYN>
       <ns1:Comment>1</ns1:Comment>
     </ns1:Question>
     <ns1:Question>
       <ns1:Point>Multiple training/conference events can be simultaneously added to the form with ease</ns1:Point>
       <ns1:optYN>1</ns1:optYN>
       <ns1:Comment>1</ns1:Comment>
     </ns1:Question>
     <ns1:Question>
       <ns1:Point>A combination of training/conference and business travel events can be simultaneously added</ns1:Point>
       <ns1:optYN>1</ns1:optYN>
       <ns1:Comment>1</ns1:Comment>
      </ns1:Question>
     <ns1:Question>
       <ns1:Point>New vendors can be added to the form with ease</ns1:Point>
       <ns1:optYN>1</ns1:optYN>
       <ns1:Comment>1</ns1:Comment>
     </ns1:Question>
     <ns1:Question>
       <ns1:Point>="New course or conference titles are easily added to the form</ns1:Point>
       <ns1:optYN>1</ns1:optYN>
       <ns1:Comment>1</ns1:Comment>
     </ns1:Question>
     <ns1:Question>
       <ns1:Point>New instructors or presenters are easily added to the form</ns1:Point>
       <ns1:optYN>1</ns1:optYN>
       <ns1:Comment>1</ns1:Comment>
     </ns1:Question>
     <ns1:Question>
       <ns1:Point>New training/conference events are sent from the form to the Training list seamlessly</ns1:Point>
       <ns1:optYN>1</ns1:optYN>
       <ns1:Comment>1</ns1:Comment>
     </ns1:Question>
     <ns1:Question>
       <ns1:Point>New vendors are sent from the form to the Training Vendors list seamlessly</ns1:Point>
       <ns1:optYN>1</ns1:optYN>
       <ns1:Comment>1</ns1:Comment>
     </ns1:Question>
     <ns1:Question>
       <ns1:Point>The email from the form to the indicated manager requesting travel approval is adequate.</ns1:Point>
       <ns1:optYN>1</ns1:optYN>
       <ns1:Comment>1</ns1:Comment>
     </ns1:Question>
     <ns1:Question/>
    </ns1:TTR_Update_Questions>

     2. Add it as a data source [TTRUpdate (Secondary)] to the form. It looks like this:

    TTR_Update_Questions (top-level)

    Question (repeating group)

    Point

    optYN

    Comment

    3. My main data source looks like this:

    UATForm

    QuestionsGroup group (not repeating)

    Questions group (repeating)

    optYN

    Question

    Comments

    4. The Questions group is added to the form as a repeating section with controls.

    5. The form's repeating section is bound to the Questions group in the Main data source.

    6. The default values have been amended to allow 25 Questions groups.

    7. A rule hides the repeating section if the Question field is blank.

    8. The Question field's default value is xdXDocument:GetDOM("TTRUpdate")/ns1:TTR_Update_Questions/ns1:Question/ns1:Point, which in Preview mode gets me 25 instances of the first question.

    How do I amend the default value of the Question field to display each question in the xml file using the preceding-sibling piece?

     Here is what I've tried,along with several variations:

    Value:

    xdXDocument:GetDOM("TTRUpdate")/ns1:TTR_Update_Questions/ns1:Question[count(current()/../preceding-sibling::ns1:Question)+1]/ns1:Point

    Error:

    "../preceding-sibling::ns1:Question" does not point to a valid location path of a field or group. 

    What am I doing wrong.  A copy of the form is attached.  I did this once before by reverse-engineering what you did in this post, but even with that successful form as a guide, I'm failing. 

     Can you help, please?

    Thanks in advance.


     

    -Nancy
  • 11-06-2012 03:41 PM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    I don't see your form attached? Can you attach it, or a screenshot of your main data source?
    Hilary Stoupa

  • 11-06-2012 03:46 PM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    Sorry about that.  Form is attached.
    -Nancy
  • 11-06-2012 05:15 PM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    It was a simple typo - you were using this: current()/../preceding-sibling::ns1:Question

    It needed to be this: current()/../preceding-sibling::ns1:Questions

    Questions is your repeating group.

    Hilary Stoupa

  • 11-07-2012 07:45 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    Thanks, Hilary, but I still get an error:

    "../preceding-sibling::ns1:Questions" does not point to a valid location path of a field or group.

    I've tried both of these and get the same error:

    xdXDocument:GetDOM("TTRUpdate")/ns1:TTR_Update_Questions/ns1:Question[count(current()/../preceding-sibling::ns1:Questions)+1]/ns1:Point

    xdXDocument:GetDOM("TTRUpdate")/ns1:TTR_Update_Questions/ns1:Questions[count(current()/../preceding-sibling::ns1:Questions)+1]/ns1:Point

    -Nancy
  • 11-07-2012 07:53 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    You are getting an error with the copy of the template I attached with my reply?
    Hilary Stoupa

  • 11-07-2012 08:15 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    No, but they look exactly the same to me. What did you change in the template?  I must not be looking in the right place.
    -Nancy
  • 11-07-2012 08:32 AM In reply to

    Re: Large Survey creation (50+ questions + option buttons), need help on method

    I changed the default value for the Question field in the main data source:

    xdXDocument:GetDOM("TTRUpdate")/ns1:TTR_Update_Questions/ns1:Question[count(current()/../preceding-sibling::my:Questions) + 1]/ns1:Point

    As I mention above, you'd had:

    xdXDocument:GetDOM("TTRUpdate")/ns1:TTR_Update_Questions/ns1:Question[count(current()/../preceding-sibling::my:Question) + 1]/ns1:Point

    Which is an invalid XPath.

    Hilary Stoupa

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