10.6.1 AsBoolean
AsBoolean は、文字列をブール値に変換します。デフォルトでは、AsBooleanは、trueまたはfalse文字列を受け取ることを想定し、その他の値の場合は 実行時エラーになります。また、デフォルトを上書きし、評価するtrueおよびfalseの値をTrueCaptionおよびFalseCaptionパ ラメータで指定することもできます。
入力パラメータ
Falsecaption - ブール状態Falseに変換する値
Truecaption - ブール状態Trueに変換する値
例
以下の例では、AsBooleanは、文字列値trueまたはfalseを想定します。
#Button.enabled := #String.AsBoolean
上記の例は、以下の例と同等です。
Case of_Field(#String)
When (= True)
#Button.enabled := True
When (= False)
#Button.enabled := False
Otherwise
Abort Msgtxt('String value cannot be converted to a Boolean')
Endcase
以下の例では、AsBooleanは文字列値YまたはNを想定します。
#Button.enabled := #String.AsBoolean(N Y)
上記の例は、以下の例と同等です。
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
また、以下も参照してください。
ÝAlphanumeric/String型組 み込みファンクション