问题描述
我有一个来自.imp文件的有效负载,有效负载内的记录 [ORDRUPDT | U | O-40541 | C | ORDRUPDT | U | O-40536 | C | ORDRUPDT | U | O-40537 | C | ORDRUPDT | U | O-40538 | C | ORDRUPDT | U | O-40539 | C | ORDRUPDT | U | O-40540 | C |] 我需要获取第1、4和3列的值,在3子3中我们可以使用$ [0],$ [2]等来获取,但是在m子4中,$ [0]语法不支持。 您能帮我取回记录吗?
解决方法
代码:
https://site.xyz/entity/Default/18.200.001/StockItem?$filter=ItemStatus eq 'Active'
结果:
%dw 2.0
import * from dw::core::Arrays
output application/json
---
payload
replace "[" with("")
replace "]" with("")
replace(" ") with ("")
splitBy("|")
divideBy 4
map() -> $[0] ++ "|" ++ $[3] ++ "|" ++ $[2]