LoginSignup
2
5

More than 5 years have passed since last update.

【BluePrism】Collectionでよく使うアクション

Last updated at Posted at 2019-04-16

Collections, Collection Manipulationは非常によく使うオブジェクトの一つです。
特にCollection Manipulationは多数のアクションがありますが、よく使うものは限られます。

↓Collection Manipulationのアクション一覧です。
image.png

見るからにいろいろできそうですが、個人的によく使うのは5つくらいです(笑)

  • Collectionsオブジェクト

    • Add Row
    • Remove All Rows
  • Collection Manipulationオブジェクト

    • Filter Collection
    • Append Rows to Collection
    • Set Collection Field

Append Rows to Collectionについては、混同しやすいMarge Collectonと合わせて解説します。

行追加

Collectionsオブジェクト:Add Row

空行を追加する場合はこれです。
Collection Manipulationオブジェクトではないことに注意です。
Collection Manipulationとは違い、コレクション名を文字列で指定する必要があります。
image.png

一括削除

Collectionsオブジェクト:Remove All Rows

例えば、ループ内で同じコレクション変数を使いまわしたい場合、
ループ冒頭でコレクションを初期化するときに使います。
image.png

絞り込み

Collection Manipulationオブジェクト:Filter Collection

絞り込み以外にも、コレクションデータの削除にも使えるので非常に便利です。

絞り込んだ結果のコレクションを別のコレクションに保持できるのがミソ。

下図の例では、絞り込み対象は経路一覧コレクションですが、結果は明細データ一覧となっています。
元のコレクションには影響を与えず、新規のコレクションに結果を格納しています。
image.png
image.png

入力・出力とも同じコレクションにすれば、データ削除としても活用できます。

列結合

Collection Manipulationオブジェクト:Marge Collection

列結合はMarge Collectionです。
下図は「経路一覧1」「経路一覧1-1」コレクションを列結合する例です。
image.png
image.png
image.png
列結合結果はJoin結果というコレクションに格納するとします。
image.png

結果↓
image.png

結合する2つのコレクションで、重複する列名があった場合はエラーになってしまいます。
image.png

行結合

Collection Manipulationオブジェクト:Append Rows to Collection

行結合はAppend Rows to Collectionです。
Marge Collectionと混同しやすいので注意しましょう。

下図は「経路一覧1」「経路一覧2」コレクションを列結合する例です。
image.png
image.png
image.png
行結合結果はUnion結果というコレクションに格納するとします。
image.png

結果↓
image.png

結合する2つのコレクションで、列数・列名が異なる場合はエラーになってしまいます。

列数が異なる場合
image.png
列名が異なる場合
image.png

行追加(Append Rows to Collection)は、ベースとなるコレクションに1行ずつ追加していく処理などでよく使います。

値代入

Collection Manipulationオブジェクト:Set Collection Field

指定した行・列に対してパラメータを代入したい場合に使います。
行インデックスを別途変数に持たせる必要がある点に注意です。
image.png

2
5
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
2
5