Highlighted
Contributor.
Contributor.
535 views

.Net Cobol

Jump to solution
In looking at the evaluate statement for the button click event, why does the evaluate txtEmailAddress::text::IsValidEmail() produce an error selection object does not match selection subject.  I put the set and evaluate validEmail in to show that it works.  I was trying to combine statements like you can do in C#.
 
method-id btnSubmit_Click final private (sender as object e as type System.EventArgs).
       local-storage section.
       01  validEmail type System.Boolean.
       
*       set validEmail = txtEmailAddress::Text::IsValidEmail()
*       evaluate validEmail
       
         evaluate txtEmailAddress::Text::IsValidEmail()
         when true
         //some code
         when false
         //some code
       end-evaluate
end method.
 
method-id IsValidEmail(s as string) returning validEmail as type Boolean extension
       local-storage section.
       try
           declare mailAddress = new type System.Net.Mail.MailAddress(s)
           set validEmail = true
       catch
           set validEmail = false
       end method.
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: .Net Cobol

Jump to solution
Development has found this to be a problem with how the compiler recognizes the Boolean type within the evaluate statement and the problem has now been addressed in our next major product release VC 3.0 which will be delivered later this year. If you could open up a support incident with Customer Care and include my name in the description then I will add the incident to the problem report so that you will be notified when the fix is available.

The workaround right now would be to break up the statement like you demonstrate and use only a data-item defined as a condition-value or a System.Boolean (full namespace) as the subject of the evaluate.
The alternative is to use an if statement which can handle the full expression without a problem.
if txtEmailAddress::Text::IsValidEmail()
*>some code
else
*>some code
end-if

View solution in original post

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: .Net Cobol

Jump to solution
Development has found this to be a problem with how the compiler recognizes the Boolean type within the evaluate statement and the problem has now been addressed in our next major product release VC 3.0 which will be delivered later this year. If you could open up a support incident with Customer Care and include my name in the description then I will add the incident to the problem report so that you will be notified when the fix is available.

The workaround right now would be to break up the statement like you demonstrate and use only a data-item defined as a condition-value or a System.Boolean (full namespace) as the subject of the evaluate.
The alternative is to use an if statement which can handle the full expression without a problem.
if txtEmailAddress::Text::IsValidEmail()
*>some code
else
*>some code
end-if

View solution in original post

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.