Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..
618 views

Format Control validation to return message when value is null

I'm trying to set up a Format Control validation that will return a message if the the value of a field is NULL.

I've tried nullsub(<field name> in $file, "1")="1" as the validation in the Validations panel of format control, but that doesn't appear to be working.  Any ideas would be greatly appreciated.

0 Likes
10 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Format Control validation to return message when value is null

Why dont you try for Validation: not null(field in $file) ?

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: Format Control validation to return message when value is null

Thanks for your reply.  This was the first thing I tried, and then realized it will only fire when there is a value in the field.  I need to do the opposite - fire when there is no value in the field.

Should null($field in $file) work?

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: Format Control validation to return message when value is null

I found a Validation string that works for this! 

lng(<field> in $file)=0

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: Format Control validation to return message when value is null

Correction.  This doesn't really work.  The message fires whether the field is null or populated 😞

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Format Control validation to return message when value is null

Just use for Validation: not null(YourField in $file)

Can you check what value in your field (use RAD debugger: d yourfield in $L.file) ?

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: Format Control validation to return message when value is null

I cant use RAD debugger because the data is being sent from another application via middleware.

I'm using SoapUI to test it, so the tag looks like this when there is a value in it:

<ns:Subcategory type="String" mandatory="?" readonly="?">SailPoint Access Request</ns:Subcategory>

And like this for a null value

<ns:Subcategory type="String" mandatory="?" readonly="?">''</ns:Subcategory>

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: Format Control validation to return message when value is null

Actually - when I thought about it I realized that I can look at the form after it's been created.  It looks like SoapUI is sending whatever I put in as the value - so two apostrophes ('') is sent as '' rather than a null value.

So I have two challenges - sending a null value in SoapUI and getting the right validation in Format Control.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Format Control validation to return message when value is null

Hi,

Why can't you just change your validation expression to be something like:

nullsub(field in $file, '')~=''

Audrey

 

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: Format Control validation to return message when value is null

My apologies - now that I have the right value in SoapUI, the validation using not(null(<field> in $file)) is working the way I want it to!

Thanks for your help.

0 Likes
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

Re: Format Control validation to return message when value is null

That works, too.  Thanks!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.