Search code examples
mulemule-elmule-component

to fetch a specific value from resultset in Mule


I have a flow that calls a MS SQL stored procedure which returns a value. The output that i get from the DB is {resultset1=[{id=30}]} i would like to store the value of id to flow variable

couldn't find a successful way to do this, Could somebody please help me in this

I'am using mule server 3.4.0 EE

Thank you in Advance


Solution

  • First place a json-to-object-transformer and then try the following :-

    <json:json-to-object-transformer returnClass="java.util.HashMap" />
    <set-variable variableName="id" value="#[payload.resultset1[0].id]" doc:name="Variable"/>