0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Workato】data_table_lookup の活用

0
Posted at

はじめに

これまで、WorkatoのFormulaモードでマスタデータを検索したい場合、使えるのは Lookup Table(ルックアップテーブル) だけでした。
しかし、ルックアップテーブルには以下の課題がありました。

  • データ型の制限:日付型などを指定できない。
  • カラム数の制限:最大10列まで。
  • 二重管理の発生:データをData Tableで管理しているのに、数式で使いたいがためにLookup Tableに同じ内容を複製する必要があった。

アップデートにより、数式内で data_table_lookup が使用可能になりました。これにより、Data Table を直接参照できます。

  • ステップ数の削減:1つの値を引くためだけに「Search Table」アクションを置く必要がなくなります。
  • メンテナンス性:データをData Tableに集約できるため、管理がスマートになります。

【重要】公式ドキュメントに載っていない「フォルダ階層」の指定方法

公式ドキュメントの例では、プロジェクト直下にData Tableがある場合しか想定されていません。

data_table_lookup('Project name', 'Table name', 'Column name': 'Value to search on')['Return column']

しかし、実際の運用では「プロジェクト」の中に「フォルダ」を作って管理していることが多いはずです。その場合、単にプロジェクト名を指定するだけではエラーになります。

解決策:フォルダパスを「/」で繋ぐ

フォルダ配下のテーブルを参照したい場合は、以下のように記述します。
複数階層をネストしている場合も / で連結すればOK。

data_table_lookup('プロジェクト名/フォルダ1/フォルダ2', 'テーブル名', '検索カラム名': '検索値')['取得したいカラム名']

使い道

配列に対してマップ処理でマスタを引きに行く場面で特に有効です。
リストアクション内のフィールドに直接 data_table_lookup を仕込めば、配列全体を1ステップで変換できます。

data_table_lookup('800[users]検証環境/kap1/blue', '部署コード変換処理用テーブル', '3桁部署コード': <3ケタデータピル>)['4桁部署コード']

image.png

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?