Hi All,Iam writing a numeric validation for a field and the same field should not accept more than 4 numerical characters.
This is my validation.
@If(@Matches(@Text(Test);“+{!A-z}”);@Success;@Failure(“Test should be numericals only”)); @length(Test)!=4;@Failure(“Length should be 4”);@Success).
Test field is of type text.
Tried with the above code,it was not prompting any error,but its taking the alphabets and numerics as well.
If i try only the numeric validation,it s workng perfectly.But if i combine both,its not working.Can any one suggest where i was doing wrong?
Subject: @If is wrong
@If(@Matches(@Text(Test);“+{!A-z}”);
@Success;
@Failure(“Test should be numericals only”));
@length(Test)!=4;
@Failure(“Length should be 4”);
@Success).
Your IF statement will always terminate in the first two clauses; if the values match, you get the success, if not, it ends in your first @Failure. the length code never executes.
@If(
CondititonOneIsTrue; Response
ConditionTwoIsTrue; Response;
ConditionThreeIsTrue; Response;
.AsManyConditionsAsYouWantHere…;
ResponseIfNoOtherConditionsAreTrue);
If you need to and/or conditions, wrap them in parenthesis.
Subject: RE: @If is wrong
Hi Finner,I was trying the way you have said.
@If(Status = “Closed” ; @Success;
@Matches(@Text(test);“+{A-z}”);@Failure(“Test should be numericals only”);
@Length(Test)!=6;@Failure(“Test must be 4 numericals only”);
@Success)
In my code,the first two conditions when status=closed and Matches are working fine,but when coming to @length its not considering as a condition.How to interpret that to treat as a condition.