Variable constraint

Hi,

I have a variable’ABC’ in input and it’s type should be integer and this variable is mandatory. I have put the int constraint on this variable and checked the input validation check box in flow service. Now, if I pass blank value in input variable ‘ABC’, it is giving me input validation error.

I don’t want the input validation error for blank or empty value. Is there any way to make it possible. I don’t want to make the variable optional.

Thanks in advance…!!

Hi,

what about “Allow Null” (nillable)?

But in this case you have to make sure that the value is checked before converting to another Integer variable.

Blank is not a valid Integer and will always fail validation. Only empty value might be accepted if the field is allowed to be empty.

Please check and confirm.

Regards,
Holger

1 Like

This is also not working.

One solution that I find, use the string constraint and then use regex which allow blank value and positive integer.

which wM version you are using, fix levels ? Any screen shots ?

Thanks,

Can you test making Required=false and Content type=integer {http://www.w3.org/2001/XMLSchema}. You can check Validate input

If you run the service with empty value it does not provide any validation error. But empty space does validation error.

Moreover what is your requirement and what are trying to achieve, can you provide more details.

Hi Mahesh,

Variable abc is mandatory but this variable is inside of document which is optional. So when we pas empty tag for this variable (like ) it will not give any validation error, I will not use any content type.

But as per my requirement, If I use content type Integer( to allow integer value and empty tag) and will pass empty tag then it’s giving error "Value doesn’t support data type.

One solution which I found is use content type string and use regex which allows integer value and empty tag only.

Please suggest any other solution is there…!!

Hi,

wm version is 9.7…!!

Hi,

wm version is 9.7…!!

Correct me if I am wrong, this is my understanding ------
create a doc (make it option by Required=false) underneath create a string variable “abc” with Content type=integer {http://www.w3.org/2001/XMLSchema}. Check “Validate input”

Run the service passing empty (no white spaces) it will not throw validation error. If you pass alphabets and numbers with decimal point it will throw “’/doc/abc DT-001 [ISC.0082.9447] Value does not conform to datatype’”

If your solution is working as expected please go ahead with it. Can you please share the screen shots of your regex with the field names.

1 Like

I would prefer the service pub.schema:validate for validation. Read BIS guide for more details.

1 Like

Did you fix this issue ? or still working on the same, what’s the progress so far ?

Thanks,

Hi,

sounds like a severe misunderstanding about options “Required” and “Allow Null”.

If a document or a field in structure is required, it must exist at least one time (minOccurs=1, default).
If it is not required, it can exist or it can be missing (minOccurs=0).

If it exists, it must contain some data (Allow Null(nillable)=false).
If it is acceptable, that it exists but without data, it should be set to allow null (Allow Null(nillable)=true).

But a regular space character is not recognized as null as the field has length=1 (the space character).
Only fields with lenght=0 are recognized to be Null.

Validating a space character against an integer type will fail with datatype mismatch.

Null fields can have two representations in XML-format:

Anything else is interpreted as non-null values.

Regards,
Holger