リレーション関数
表をまたいで値を取る xlookup、JSON からフィールドを取る json.select、配列型の文字列から n 番目を取る valueat、そして JSONPath の書き方。
このマニュアルの日本語は解説文です。アプリの画面表示は英語のため、メニュー名・ボタン名・エラーメッセージは画面どおり英語で表記し、スクリーンショットも英語画面のものを使っています。
別の表・JSON・配列の中の値を、この列に取ってきます。xlookup は Match パネルが生成する関数です。json.select は HTTP 接続や JSON 取り込みと組み合わせてよく使います。
表記の約束:列は列コードで参照します(AA6 など)。関数名は大文字小文字を区別しません。テキストはダブルクォートで囲み、条件では and / or が使えます。例文の "In the result column, enter" は「新しい列の数式バーに書く」という意味です。以下の説明はアプリ内の関数ヘルプと同じ英語の文面です —— 画面に出るものとそのまま照合できるよう、訳さずに載せています。
xlookup
Searches a table, matches conditions to retrieve values
Formula Description
Searches the original table, matches conditions for equality, and retrieves the value from the "original table content column" to write into the result table.
Formula Syntax
In the result column, write: XLOOKUP(result table condition matching column, original table condition matching column, original table content column to lookup)
- All parameters can use data columns, i.e., the CODE at the top of each column in the table data, such as AA1
- Result table condition matching column: The column to match in the result table (the table where the current formula is being written)
- Original table condition matching column: The column to search and match in the original table
- Original table content column to lookup: The column in the original table from which to retrieve content
vlookup
Formula Description
Searches for a value in the first column of a table and returns a value in the same row from a specified column.
Formula Syntax
In the result column, enter: vlookup(lookup_value, table_array, col_index_num, [range_lookup])
- lookup_value: The value to search for in the first column of the table
- table_array: The range containing the lookup value and return value
- col_index_num: The column number to return the value from
- range_lookup: Optional, specifies the match type, default is exact match
json.select
Formula Description
Retrieves a value from JSON data using a key.
Formula Syntax
json.select("JSON data string", "key to select")
- JSON data string: Must be a valid JSON string
- If the key to select doesn't exist in the data, it returns an empty value
- All parameters can use data columns, i.e., the CODE at the top of each column in the table data, such as AA1
valueat
Formula Description
Retrieves the nth value from an array-type string.
Formula Syntax
In the result column, enter: valueat(array-type string / column number, position n)
- Array-type string: Must be enclosed in "[]", e.g., [1,2,3]; if the string is not array-type, the formula returns an empty value
- Position n: Starts from 1; if the position exceeds the array length, it returns an empty value
- All parameters can use data columns, i.e., the CODE at the top of each column in the table data, such as AA1
union
この関数の詳細説明はアプリに同梱されていません。数式エディターの関数ヘルプが正です。
convertunion
Formula Description
Combines values from multiple columns into a single column.
Formula Syntax
In the result column, enter: convertunion(column_number1, column_number2, ...)
- column_number: The columns to combine, e.g., AA1, AD12
convertselect
Formula Description
Selects specific columns from multiple columns.
Formula Syntax
In the result column, enter: convertselect(column_number1, column_number2, ...)
- column_number: The columns to select, e.g., AA1, AD12
groupby
この関数の詳細説明はアプリに同梱されていません。数式エディターの関数ヘルプが正です。
JSONPath の書き方
json.select、HTTP 接続の「define the data structure」の段階、そして JSON 取り込みは、いずれも JSONPath で JSON の中のノードを指します。XML に対する XPath にあたるもので、ドット記法 $.store.book[0].title とブラケット記法 $['store']['book'][0]['title'] の両方を受け付けます。
| 記号 | 意味 |
|---|---|
$ |
ルート |
. または [] |
子ノード |
.. |
任意の深さの子孫 |
* |
ワイルドカード(すべてのメンバー) |
[n] |
配列の n 番目(0 起点)。[-1:] は最後の 1 つ |
[a,b] |
複数の添字 |
[start:end] |
範囲を切り出す |
[?(式)] |
条件で絞り込む。例:$.items[?(@.status == 'paid')] |
$..* |
すべてのメンバー |
API が「配列をオブジェクトで包んだもの」を返すときは、HTTP 接続のデータ構造を配列の階層($.data.list[*])に向けてください。要素 1 つが 1 行になります。