I'm struggling with a validation rule on a new responsive form. In the classic form that I'm replacing, the rule applied to the Cost Centre control was:
contains(GL code, "5580")&¬(contains(Cost Centre, "35")||contains(Cost Centre, "36")||contains(Cost Centre, "38"))
The function was to invalidate the control if GL code contained 5580, but the Cost Centre control did not contain 35 or 36 or 38.
Any ideas how to replicate this in a new responsive form?
I've tried various combinations of this type of formula, but I can't get it to work.
convertToString(contains([Form].[Repeating section 1].[Current row].[Cost centre], "35") || (contains([Form].[Repeating section 1].[Current row].[Cost centre], "36") || contains([Form].[Repeating section 1].[Current row].[Cost centre], "38")))
Any suggestions appreciated!
Solved! Go to Solution.
This business rule make it hard to validate your form. The NOT (multiple values)
Cost Centre control did not contain 35 or 36 or 38.
Solution: Consolidate the OR Rules
1. Add another control to your Repeating Section. Text-Short, Choice - Up to you.
A Text-Short control is used here.
The purpose of this control is to consolidate the OR conditions
TIP: Show this control during Development/Testing. Hide it later.
Add a Form Rule to the Repeating Section. Set the control to a YES state when the following Condition is met - Cost Centre control contains 35 or 36 or 38.
Set the following Rule:
If Cost Centre contains 35 or Cost Centre contains 36 or Cost Centre contains 38
then control value is YES
else control value is -blank-
Now that you have consolidated the OR rules.
Create a new Rule (using Submit Rule here)
If GL Code contains 5580 and Control does not contains YES
then Show Validation Error
Here is the final result
Lastly, don't forget to HIDE the CONTROL once your testing/development is done!