Unicode Intrinsic Functions - AsBoolean Method

Return a string as a Boolean

Member of Unicode Intrinsic Functions (PRIM_LIBI.IUnicodeIntrinsics)


Name Type Data Type Description
Result *Result (Optional) Boolean Resulting Boolean
FalseCaption *Input (Optional) Unicode String Value to use as the false value
TrueCaption *Input (Optional) Unicode String Value to use as the true value


AsBoolean converts a variable to a Boolean. By default, AsBoolean expects to receive a true or false string. Any other value will result in a runtime error. Optionally, you can override the defaults and specify the true and false values to be evaluated using the TrueCaption and FalseCaption parameters.


In this example, Asboolean expects a string value of Y or N
#Button.enabled := #NChar.AsBoolean(N Y)
This is equivalent to writing
Case of_Field(#NChar)
When (= Y)
#Button.enabled := True
When (= N)
#Button.enabled := False

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020