LoginSignup
4
1

More than 3 years have passed since last update.

Automation Anywhere A2019 で変数の「型キャスト」を使いこなす

Last updated at Posted at 2020-05-03

概要

Automation Anywhere A2019は変数についてインラインでの「型キャスト」が利用可能です。

このことは製品ドキュメントの「User-Defined Variables」の英語版記事を読んでいると気づきます。(2020年6月中旬に専用の記事「Type Casting」ができていました)

Type casting (converting variable values)
The values inside of a Boolean, DateTime, Number, or String variable can be converted from one type to another type. For example, use the String > To number action to convert the value of a String variable into a Number variable in order to perform mathematical operations.

You can temporarily convert the value of a variable for use in just one action. In the text field, enter $<variable name>.. After you enter the period, the auto-fill suggests possible actions, such as toString.

「アクションの詳細」のフィールド内で$<変数名>.とタイプすると、以下のようにアクションとして可能な候補が表示されます。
image.png

型キャストは例えば以下のような書式になります。

$prompt-assignment.String:length$

また、型キャストはネストして使うこともできます。

$n.Number:increment.Number:toString$: nの値を1足した後に文字列にする。

型キャストは全部で21個利用できます。すべての型と互換性のある任意 (Any) 型では、すべての型キャストが利用できます。

文字列 (String) 型で使える型キャスト

型キャスト 型キャスト後の型 説明
LegacySupport:getDecrementedNumber 数字 文字列を数字に変換して1を引きます。
LegacySupport:getInrementedNumber 数字 文字列を数字に変換して1を足します。
String:length 数字 文字列の長さを返します。
String:lowercase 文字列 文字列を小文字に変換します。
LegacySupport:parseLegacyKeys 文字列 10.x、11.xの旧来のキーストロークを最新の書式に変換します。
LegacySupport:parseVariableOperation 文字列 10.x、11.xのVariable Operationコマンドと同様の式解析をします。新しく作成するBotでは使わないでください。
String:reverse 文字列 文字列を反転させます。
String:toBoolean Boolean Booleanに変換します。
String:toNumber 数字 文字列を数字に変換します。
String:trim 文字列 文字列の空白をカットします。
String:uppercase 文字列 文字列を大文字に変換します。

数字 (Number) 型で使える型キャスト

型キャスト 型キャスト後の型 説明
Number:decrement 数字 数字から1を引きます。
Number:increment 数字 数字に1を足します。
Number:toString 文字列 数字を文字列に変換します。

日時 (Datetime) 型で使える型キャスト

ありません。

Boolean 型で使える型キャスト

型キャスト 型キャスト後の型 説明
Boolean:invert Boolean 変数値を反転します。
Boolean:toNumber 数字 Booleanを数値に変換します。
Boolean:toString 文字列 Booleanを文字列へ変換します。

任意 (Any) 型で使える型キャスト

型キャスト 型キャスト後の型 説明
DataTable:columnCount 数字 テーブル内の列の数を返します。
Number:decrement 数字 数字から1を引きます。
LegacySupport:getDecrementedNumber 数字 文字列を数字に変換して1を引きます。
LegacySupport:getInrementedNumber 数字 文字列を数字に変換して1を足します。
Number:increment 数字 数字に1を足します。
Boolean:invert Boolean 変数値を反転します。
String:length 数字 文字列の長さを返します。
String:lowercase 文字列 文字列を小文字に変換します。
LegacySupport:parseLegacyKeys 文字列 10.x、11.xの旧来のキーストロークを最新の書式に変換します。
LegacySupport:parseVariableOperation 文字列 10.x、11.xのVariable Operationコマンドを探します。新しく作成するBotでは使わないでください。
String:reverse 文字列 文字列を反転させます。
DataTable:rowCount 数字 テーブル内の行の数を返します。
Dictionary:size 数字 辞書内のエントリー数を返します。
List:size 数字 リストの項目数を返します。
String:toBoolean Boolean Booleanに変換します。
Boolean:toNumber 数字 Booleanを数値に変換します。
String:toNumber 数字 文字列を数字に変換します。
Boolean:toString 文字列 Booleanを文字列へ変換します。
Number:toString 文字列 数字を文字列に変換します。
String:trim 文字列 文字列の空白をカットします。
String:uppercase 文字列 文字列を大文字に変換します。

レコード (Record) 型で使える型キャスト

ありません。

リスト (List) 型で使える型キャスト

型キャスト 型キャスト後の型 説明
List:size 数字 リストの項目数を返します。

ディクショナリ (Dictionary) 型で使える型キャスト

型キャスト 型キャスト後の型 説明
Dictionary:size 数字 辞書内のエントリー数を返します。

テーブル (DataTable)型で使える型キャスト

型キャスト 型キャスト後の型 説明
DataTable:columnCount 数字 テーブル内の列の数を返します。
DataTable:rowCount 数字 テーブル内の行の数を返します。

ファイル (File)型で使える型キャスト

ありません。

ウィンドウ (Window)型で使える型キャスト

ありません。

参考記事

Automation Anywhere A2019の変数についての一般的な記事は以下を参照してください。

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1