Help finding right rule combination for this to work!! - InfoPath Dev
in

InfoPath Dev

Help finding right rule combination for this to work!!

Last post 11-01-2013 06:14 AM by leebrockney. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 10-25-2013 06:40 AM

    Help finding right rule combination for this to work!!

     Hello,  I am new to InfoPath but am designing a quality scorecard for use by our quality team while monitoring and reviewing processes.  The form has a basic info section, a quality section, and a compliance section.   I have everything setup correctly but now I am trying to add 3 fields that provide the user with the final quality score by adding the 2 section score totals together.  Those fields are QualityScore (Section 1), ComplianceScore (Section 2), TotalScore. 

     

    Section 1's total (QualityScore) is working fine as it is just a basic addition formula that adds up the value of the 5 questions in that section and displays the total.   The ComplianceScore and the TotalScore is where I cannot for the life of me figure out how to get it to work.   

     

    The Compliance section is 16 questions.  Questions 1 and 12, if answered no, return a value of -1 (reduction of quality score by 1).  Questions 3, 6, and 11, if answered no, return a value of -2 (reduction of quality score by 2).

    if it ended here I would again just do a simple addition formula in the ComplianceScore textbox control and then in the TotalScore textbox control just add the formula QualityScore + ComplianceScore.  The issue is that the remaining questions (2,4,5,7,8,9,10,13,14,15,16 (these return a 1 if No)) are requirements so if any of them are answered with a "No" the TotalScore is automatically 0 and the ComplianceTotal textbox control should display the Text "Compliance Failure". 

     I have put rules on the questions, I have tried rules on the ComplianceScore control and none of them work all the time.  I can get them to work sometimes but the results seem to change depending on the order by which I select the answers.  This would be so much simpler to me if I could just put an If Statement in the formula bar for the TotalScore.  IF(SUM(2,4,5,7,8,9,10,13,14,15,16) > 0, 0, QualityScore + ComplianceScore) while the formula for the ComplianceScore would be IF(SUM(2,4,5,7,8,9,10,13,14,15,16) > 0, "Compliance Failure", Q1+Q12+Q3+Q6+Q11).  

    Can someone help me figure this out!!  Thanks!

     

    Lee

  • 10-25-2013 09:24 AM In reply to

    Re: Help finding right rule combination for this to work!!

    Hey Lee. Hope I can help some what. Compliance section: Question 1, 12: use radio buttons, set the value for the yes as 1 and no to -1 Questions 3,6,11: use radio buttons, set the value for the yes as 1 and no to -2 have a hidden field (we'll call it "hdnComplienceSectionValue"), data type a s a whole number (Integer). You can place an action rule on each radio button group to set a fields value [no condition] Field: hdnComplienceSectionValue Value: hdnComplienceSectionValue + . //the "." is the current radio button groups value either 1 for yes or -1/-2 for no depending on the question # The value hdnComplienceSectionValue + . will be used for all radio button in the compliance section. Its basically taking the hdnComplienceSectionValue value say 0 and addind the radio buttons value. From here you can set a calculated value field or a new textboxs default value to the hdnComplienceSectionValue. or TotalScore's value= QualityScore + hdnComplienceSectionValue. ///////QUOTE//////For the remaining questions (2,4,5,7,8,9,10,13,14,15,16 (these return a 1 if No)) the TotalScore is automatically 0 and the ComplianceTotal textbox control should display the Text "Compliance Failure". For this part I am assuming your using radio buttons or a drop down and the value for Yes is "0". Here's what I would do: 1) create a hidden field (whole number) on your form and set its deafult value to 0. (we'll call it "hdnNoAnswers") 2) for questions 2,4,5,7,8,9,10,13,14,15,16; set an action rule to set the hdnNoAnswers value to "hdnNoAnswers + ." *same as above, were taking the hdnNoAnswers current value and adding either a 0(yes) or 1(no) 3) create an action rule on that hdnNoAnswers: set the condition to hdnNoAnswers > 0 and run these actions to set a fields value to: ComplianceTotal = "Compliance Failure" * basically if any no was selected the it will set the ComplianceTotal textbox to that value orther wise it should do all the math you want So basically if anyone selects no the hdnNoAnswers will incriment by 1 I hope this helps and makes sense. Theres probably an easier way, such as using true/false values but this should work. Brunettej
  • 10-25-2013 10:48 AM In reply to

    Re: Help finding right rule combination for this to work!!

     Thanks!  This is very similar to what I did before.  I am using drop down boxes instead of radio buttons but the idea is the same.  The issue is that when I go back and change one of the selections it then starts to miscalculate.

     For instance,  say I make Q1 a "No".  that turns the HdnComplianceSectionValue to a -1.  Then I make Q3 a "no" and that then changes the HdnComplianceSectionValue to a -3.  (This is right up to this point).  But if the user accidently chose "No" and tries to change it back to "Yes", the HdnComplianceSectionValue changes to -2 instead of -1 because it is just adding the new value to the existing erroneous value.  Does that make sense? 

  • 10-25-2013 11:04 AM In reply to

    Re: Help finding right rule combination for this to work!!

     Also,  this would leave the possibility of you having a positive score in the compliance Section.  The only outcomes within compliance are a score of 0, -1, -2, -3,-4,-5,-6,-7, -8, or "Compliance Failure". 

  • 10-25-2013 12:41 PM In reply to

    Re: Help finding right rule combination for this to work!!

    Ok, I get it. I didnt get that your score is is going to be negative. In that case I would set the questions where if "no" was selected, set their value to true; "yes" is false. Create a hidden field (hdnBoolean) and set that fields default value to false. On your dropdowns if Question 2's answer was choosen as "no", create a rule to set that hiddenField's value to true. Now same as I mentioned before. Have an additional action rule on you total where if the condition: hdnBoolean = true and run these actions to set a fields value to: ComplianceTotal = "Compliance Failure". This way your not messing with numbers but rather set a hidden fields value to true or false. In this case if any no's were selected, the hdnBoolean will become true. if hdnBoolean is true at any poinmt set your total to "Compliance Failure". if the answers were changed to yes the hdnBoolean field would change back to false, allowing the "Compliance Failure" to be removed and your normal math would be performed. Hopefully I am making sense.
  • 10-25-2013 01:00 PM In reply to

    Re: Help finding right rule combination for this to work!!

    basically this would act like a if/else statement boolean hdnBoloean = false; if(Question1 = no) { hdnBoloean = true; } if(Question3 = no) { hdnBoloean = true; } if(Question3 = no) { hdnBoloea3 = true; } if(Question1 = yes) { hdnBoloean = false; } if(Question3 = yes) { hdnBoloean = false; } if(Question3 = yes) { hdnBoloea3 = false; }
  • 10-31-2013 01:28 PM In reply to

    Re: Help finding right rule combination for this to work!!

    Did you get it to work? Just curious.
  • 11-01-2013 06:14 AM In reply to

    Re: Help finding right rule combination for this to work!!

     Yes Sorry!!  Got caught up in another project and had to put this aside for a bit.  I got it working last night using the outline you provided.  Thank you very much!! 

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