How to check more than 5 fields under action rule condition in infopath 2010

StackOverflow https://stackoverflow.com//questions/9590754

  •  08-12-2019
  •  | 
  •  

Question

I am working on an infopath 2010 form/view based on a list.

I have 7 separate check box fields that I want to check through a rule under submit button that at least one of them should be selected.

Trying to do this and check for the condition, it is allowing me to check a maximum of 5 fields at a time.

How can I check at least one of these 7 check boxes is selected before submitting the data?

Était-ce utile?

La solution

Here's an idea: Use an integer field and put a rule on each of your 7 checkboxes that adds 1 to the field. Then your final validation rule just needs to be sure the integer field is greater than zero

(Better also have a rule to subtract 1 if a box is unchecked after being checked.)

-Glen

Autres conseils

You can overcome this by changing your last condition to "The expression" and use "and" or "or" as needed to create your compound condition. So, for example, if you need to make sure both field1 and field2 are not blank, you'd use the expression:

     my:myFields/my:field1 != "" and my:myFields/my:field2 != ""

If you need help figuring out the correct syntax for your expression, first set up the condition using the drop downs (for example, select field1 in your first drop down, then "is not blank" in your second drop down), then change the first drop down to "The expression" -- whatever your condition was will auto populate into the box for the expression. Paste that into a text editor, and then do the same for the rest of your conditions. Add and or or between them as needed, and you have your expression!

Source: http://www.infopathdev.com/forums/p/14871/52819.aspx

I had a similar issue and avoided using "The Expression" option because I had so many conditions to check before allowing a user to submit the form for certain scenarios, and it would have been very tough to debug and troubleshoot. I also considered Glen's sum-based solution because it made troubleshooting difficult as you can't really tell which condition is missing, and you can't perform logical checks on what's been selected or filled-in properly.

My solution was to set up a text CheckStatus field and a numeric CheckStatus-Value field. Rules on tested fields would add values to the CheckStatus field when the needed conditions were met. And when the CheckStatus-Value field hit the “magic number” (6 in the example below), then I would allow the user to submit the form. As an example, the CheckStatus-Value and CheckStatus fields are shown below, but would be hidden when the form is ready for production use: CheckSum-Value & CheckSum fields

Then for every desired field, I assign a unique letter from “A” to “Z”, or from “a” to “z”, or from “0” to “9”, and test for the desired condition. In this way you could test for up to 62 concurrent conditions, tho that would be a bit crazy 😊 Every time the CheckStatus field changes, a rule runs to count the number of values and update CheckStatus-Value: Update CheckSum-Value field

IF the condition is True AND the CheckStatus field does not already contain the unique letter/number assigned to that field, then I add the assigned number/letter (using the concat function) to the CheckStatus field. If a blank value is a valid value under specific conditions then I add the letter/number for the field when that condition is met, so a ready-to-submit form always has the same value in the CheckStatus-Value field. (If a valid value is changed to a different valid value, ensure the letter/number is only added ONCE to the CheckStatus field.) Add value A to CheckStatus field   IF the condition is False, then I remove the assigned number/letter (using the translate function) from the CheckStatus field. Remove value A from CheckStatus field

IF the field being tested (Field-A) is dependent on another field (Field-B), I also add the Field-A rule to Field-B, so the user does not have to touch Field-A to update the CheckStatus. Be careful when copy-pasting the rules; remember InfoPath will change field names automatically! I also added the “’Add-x”’ rules to the Form Load rules (on the Data tab) to update CheckStatus every time the record is loaded. Hope this helps! -Steve

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top