PD
Novice

New Responsive Form - validation rules

Jump to solution

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")&&not(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!

2022-06-15_09-34-44.jpg

Labels: (1)
0 Kudos
Reply
2 Replies
Garrett
Communicator

Re: New Responsive Form - validation rules

Jump to solution

Hi @PD 

 

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.

Garrett_0-1655247064577.png

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-

Garrett_1-1655247252028.png

 

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

Garrett_2-1655247851535.png

 

Here is the final result

Garrett_3-1655248107918.png

 

Lastly, don't forget to HIDE the CONTROL once your testing/development is done!

 

Reply
PD
Novice

Re: New Responsive Form - validation rules

Jump to solution

Thank you @Garrett! That worked perfectly.

0 Kudos
Reply