0

Sql query returns a streamed output as Resultset iterator object from the Database component. i want to convert this to xml in dataweave. But don't know how to refer the incoming object, If it's a map i can access it simply by using .operator like payload.student

Tried using payload.next() but it gives an error. Also tried the following, %var input1 payload as :iterator but still wont' work

4

2 回答 2

0

Can you post your code (XML) and a screenshot of dataweave or debugger? My first guess would be to use a standard transfomer to transform that object to a list or map before the dataweave transformer.

于 2015-11-27T16:55:17.257 回答
0

Here the steps:

  • Drag and drop the Transform Message (Dataweave) component after your configured DB Connector. You will see that the input payload for dataweave script is filled with the db result List<Map>.

  • Then you can access the fields, using the map function in dw.

dw script

%dw 1.0
%output application/xml
---
{
    "Results":{
        (payload map {
            "key1":$."db_field1",
            "key2":$."db_field2"
        })
    }

}
于 2015-11-27T18:34:45.013 回答