我在缓存中有数据,即objectstore。我需要从缓存中获取数据并在其上应用过滤条件。如何在dataweave mule的过滤条件中传递动态fieldName
这里需求是,我必须公开api来获取基于filedName和filedValue的数据,这些数据将在请求中动态生成。
样品要求:
https://localhost:8082/api/customer/filter?fieldName=customerId&fieldValue=101810
我不得不返回代码来筛选dataweave的数据,但它不工作。可以请你在这个
%dw 1.0
%output application/json
---
payload.rows filter (("$.content." ++ flowVars.fieldName ++ ".content") as :string == flowVars.fieldValue as :string) map ((row , indexOfRow) -> {
customerId: row.content.customerId.content as :string when row.content.customerId.content != null otherwise null,
customerName: row.content.customerName.content as :string when row.content.customerName.content != null otherwise null,
customerAddress:row.content.customerAddress.content as :string when row.content.customerAddress.content != null otherwise null
})
帮助,我得到以下错误
Exception while executing:
payload.rows filter (("$.content." ++ flowVars.fieldName ++ ".content") as :string == flowVars.fieldValue as :string) map ((row , indexOfRow) -> {
^
Type mismatch for '++' operator
found :object, :string
required :string, :string.
可以请你在这个
请发布其用于设置字段名和fieldValue方法在对象存储或flowVars – AnupamBhusari
我们得到他们作为查询参数将来自这样 字段名=客户ID和fieldValue方法= 101810 – Gopi
要求从上面的映射,我们会得到字段名作为客户ID或代码CustomerName或CustomerAddress来过滤数据,而filedVaule是该字段的相应值。[{ \t \t \t “标签”: “530”, \t \t \t “内容”:{ \t \t \t \t“可以请你在这个 – Gopi