10 6 26 IsBoolean

LANSA Technical

10.6.26 IsBoolean

IsBoolean tests a string to determine whether it can be used as a boolean. The Truecaption and Falsecaption parameters define the allowable values for the Boolean.

IsBoolean will often be used before 10.6.1 AsBoolean to so that you can trap a potential run-time error.

Input Parameters

Falsecaption - Value to represent a Boolean state of False

Truecaption - Value to represent a Boolean state of True

If no input parameters are specified, the function expects to receive the strings True or False.

Example

In this example, isBoolean expects a string value of N or Y:

If (#String.IsBoolean(N Y))

 

#Button.Enabled := #String.IsBoolean(N Y)

 

Else

 

* Error processing

 

Endif

 

This is equivalent to writing the following:

Case of_Field(#String)

 

When (= Y)

#Button.enabled := True

 

When (= N)

#Button.enabled := False

 

Otherwise

Abort Msgtxt('String value cannot be converted to a Boolean')

 

Endcase

 

Ý 10.6 Alphanumeric/String Intrinsic Functions