onenonlyyash Valued Contributor.
Valued Contributor.
559 views

Format Control validation lng($variable)

In SD i'm using a validation that is 

lng($extension) <7

then messge is  "Extension length shoulb have minimum 7 digits"
previously it was working but now it's showing message on both condition lessthan or morethan 7 digits.

I also used lng($G.extension) <7 but there is same behaviour like above case.
refer screenshots

0 Likes
5 Replies
Micro Focus Expert
Micro Focus Expert

Re: Format Control validation lng($variable)

While that form is open, run rad debugger and display the global var.

d $G.extension

See what value you are getting. I'm surprised you are using global variable and not the field on the form. Global variable can be changed anywhere. Something like phone.number in $file is specific to the form on the screen.

0 Likes
Highlighted
onenonlyyash Valued Contributor.
Valued Contributor.

Re: Format Control validation lng($variable)

output is "Value is NULL"
0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Format Control validation lng($variable)

Which is why the length function is failing.  You cannot get length from a null value. Why don't you do a display on the phone number field. e.g d phone.number in $file. I am not sure what is the real field name. 

If you get a non null value and its display the correct phone extension number, you can use that instead of $G.extension. It may be easier than trying to find why the code that populate $G.extension or $extension is no longer working.

0 Likes
Nick_Karpushkin Respected Contributor.
Respected Contributor.

Re: Format Control validation lng($variable)

As you are setting the cursor position to the "extension" field then I suppose you are willing to check the value entered in that field. In this case the condition should look like this:

lng(extension in $file)<7

But in addition if this is a mandatory field in your system then I'd insert one more validation before checking the length of the value:

not (null(extension in $file))

If you still need the varaible's value - simply replace the "extension in $file" with the variable's name.

onenonlyyash Valued Contributor.
Valued Contributor.

Re: Format Control validation lng($variable)

this is also not working
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.