3 Replies Latest reply on Jan 27, 2017 1:12 AM by CamelCase_data

    CWP: Validation «not empty» fails if value is zero


      Product and version: FileMaker Server

      OS and version: macOS Sierra 0.12.2

      Hardware: MacBook Pro (Retina, 15-inch, Mid 2015), 2.2 GHz Intel Core i7, 16 GB RAM


      I'm using pre-validation in a CWP-solution where validation for a field with value «0» fails with error code «1 - FILEMAKER_RULE_NOTEMPTY». I want the value «0» to be accepted, as the field is not empty. Is there a setting in FileMaker to accept «0» as not empty?


      Any other number than 0 works and an empty value returns the not empty error as it is supposed to.


      The field has validation rules defined in FileMaker. In short, it must be numeric only and not empty. A screenshot of the rules is attached.


      How to replicate
      1. Set validation rule to «not empty»

      2. Create newAddCommand with value «0»

      3. Validate the newAddCommand
      $result = $addrequest->validate();
      4. Echo field name, error code, and field value.

           echo 'Validation failed:'. "\n";

           $validationErrors= $result->getErrors();

           foreach ($validationErrors as $error) {

                $field = $error[0];

                echo 'Field Name: ' . $field->getName(). "\n";

                echo 'Error Code: ' . $error[1] . "\n";

                echo 'Value: ' . $error[2] . "\n"; } }


      Handle this edge-case in code.