Unicode Intrinsic Functions - AsBoolean Method

Return a string as a Boolean

Member of Unicode Intrinsic Functions (PRIM_LIBI.IUnicodeIntrinsics)

Parameters

NameTypeData TypeDescription
Result*Result (Optional)BooleanResulting Boolean
FalseCaption*Input (Optional)Unicode StringValue to use as the false value
TrueCaption*Input (Optional)Unicode StringValue to use as the true value

Details

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.

Example

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
 
Endcase

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2