Compatible Unicode Intrinsic Functions - AsBoolean Method

Return a string as a Boolean

Member of Compatible Unicode Intrinsic Functions (PRIM_LIBI.ICompatibleUnicodeIntrinsics)

Parameters

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

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

  • No labels