Examples: Input validation formulas

  1. This input validation formula doesn't let the Cost field exceed 100.
    @If(Cost<100; @Success; @Failure("Cost must be less than $100"))
  2. This formula forces the user to enter a ten-digit number. The formula removes up to two hyphens if they are present. The formula converts the result to a number and returns a failure if an error occurs on the conversion. The formula converts the number back to text and checks its length, returning a failure if the length is incorrect. This last step is necessary because @TextToNumber successfully converts, for example, 123A to 123.
    N1:= @If(@Contains(Home_Phone; "-"); @Left(Home_Phone; "-")+ @Right(Home_Phone; "-"); Home_Phone);
    N2:= @If(@Contains(N1; "-"); @Left(N1; "-")+@Right(N1; "-"); N1); 
    N := @TextToNumber(N2);
    @If(@IsError(N);@Return(@Failure("Home phone must be zip-xxx-xxxx."));     @Success);
    @If(@Length(@Text(N))!= 10;@Failure("Home phone must be zip-xxx-xxxx.");    @Success)