Dropdown Calculations - InfoPath Dev
in

InfoPath Dev

Dropdown Calculations

Last post 12-11-2014 08:10 AM by Tughsol. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-03-2014 08:41 AM

    Dropdown Calculations

    I'm not necessarily new to InfoPath, but I have run across an issue that I've been unable to solve logistically myself. I have a form that has several questions, Yes/No or N/A. The user would like the drop downs to calculate and re-calculate depending on how many questions are answered with an N/A.

    For instance, section one is worth 30 points total. If the answer is N/A they do not want that to factor into the total calculation for the section, thus making the remaining questions worth more points. If all five questions are answered, they are worth 5 pts each, if only 4 are answered and 1 is N/A they are worth 7.5 pts each, if only 3 are answered and 2 are N/A they are worth 10 pts each, etc.. I tried to use the rules to do this, and it worked to a certain extent, but then my drop down choice on shows "Select..." and will not show Yes, No or N/A on the form.

    Any ideas??

     

    Thank you!! 


  • 12-11-2014 08:10 AM In reply to

    Hi TechThompson,

    I think I understand what you are trying to do here! Is the only real issue you are having with the dropdown changing to "Select..." because of the Rules? If so how about removing the "Select..." as an option and setting a different Default Value - not sure if this will work or not as I'm not entirely sure what Rules you have created. 

    I may be making this more complicated than it needs to be so someone else may post a better reply, but... 

    On almost all InfoPath Forms I work on I usually create a new View of the Form to contain miscellaneous fields to help me out. You can then hide this View from appearing for users filling out the Form.

    My idea would be to create this miscellaneous view to help you handle the calculations. For example on the dropdown box give N/A a value of 0, Yes a value of 1 and No a value of 2. Then create a Field that Concats (are you familiar with this function?) all of the Yes values into this text box. What you will get will be a text box displaying a numerical value for each instance of Yes ie. If 3 questions are Yes it will look like 111 if two questions are Yes it will look like 11

    Create a second text box that has a Default Value of the String Length of the first text box and minus 1 (as it picks up the cursor as a 1 by default). This will then tell you exactly how many questions have been answered Yes. You can then repeat this process for No and N/A. What you will be left with is 3 Text Boxes telling you how many questions are Yes, No and N/A. You can then apply Rules to these fields (instead of the dropdown boxes) in order to calculate their score. ie a Rule that says "IF Yes Answers = 3 THEN * 10" or "IF Yes Answers = 4 THEN * 7.5

    I hope this makes sense and I have understood your question properly and not just wasted your time! It looks a fairly long winded process but its actually not too bad. As I said before I may be making this harder than it needs to be though so someone else may give you better advice. 

    If you try and go for this option let me know if you have any issues and I'll try to help. 

    Thanks

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