清單
六個節點,專門處理集合 — 通常就是某個 API 剛回傳的那個陣列。
Aggregate(彙總)
Section titled “Aggregate(彙總)”把一份清單歸約成單一個值。
| 輸入 | items(json) |
| 輸出 | result |
| 設定 | op:count、sum、min、max、average、join — 另外還有 field(要彙總的屬性)與 separator(給 join 用) |
HTTP 請求 ──response[body.commandes]──► Aggregate (sum, field: montant)Map(映射)
Section titled “Map(映射)”轉換清單裡的每一個項目。
| 輸入 | items |
| 輸出 | mapped(json) |
| 設定 | property(取出某個屬性)或 expression(一個套用到每個項目上的 Handlebars 範本) |
Filter(篩選)
Section titled “Filter(篩選)”把一份清單分成兩份。
| 輸入 | items |
| 輸出 | kept(json)、rejected(json) |
| 設定 | property、operator(lt、lte、eq、gte、gt、ne、contains)、value |
兩個輸出都有用:把 rejected 接到一個 Assert 上,一旦出現不該出現的項目就讓
執行失敗。
| 輸入 | list(清單)、一個預設值,以及每個已設定的值各一個連接埠 |
| 輸出 | result(json) |
| 設定 | list(一個 variable 型別的值,或由接線提供)、values(要加進去的項目)、updateSourceVariable(預設 false) |
啟用 updateSourceVariable 時,這個節點會直接寫進指定的執行變數:要在迴圈過程
中累積結果,靠的就是這個。
形式和上一個相同;它會移除與所給值深度相等的項目。
List ops(清單操作)
Section titled “List ops(清單操作)”結構性的操作。
| 輸入 | value(清單)、key(字串) |
| 輸出 | result |
op | 效果 | 欄位 |
|---|---|---|
sort | 排序 | key、order(asc / desc) |
unique | 去除重複 | — |
reverse | 反轉 | — |
flatten | 攤平 | depth(預設 1) |
chunk | 切成小塊 | size |
slice | 取出一段 | start、end |
groupBy | 依鍵分組 | key |