String Intrinsic Functions - AsBoolean Method

Return a string as a Boolean

Member of String Intrinsic Functions (PRIM_LIBI.IStringIntrinsics)

Parameters

NameTypeData TypeDescription
Result*Result (Optional)BooleanResulting Boolean
FalseCaption*Input (Optional)StringValue to use as the false value
TrueCaption*Input (Optional)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 := #String.AsBoolean(N Y)
This is equivalent to writing
Case of_Field(#String)
 
When (= Y)
#Button.enabled := True
 
When (= N)
#Button.enabled := False
 
Endcase

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2