
Questions: 23,672 //
Answers: 52,200 //
Contributing Members: 17,942
I am retrieving some data using stored procedure and calling it within the database connector in mule. I have to include a condition when I pass a value which is not there in the database it should capture the error. For this I am using a choice component where I have to check whether the payload is null. But when running the flow in debug mode I found that the payload holds the value {resultSet1=[]}. I tried #[message.payload.isEmpty()], #[message.payload!=null] and #[payload.resultSet1 != null]. But they weren't working. Could anyone help to resolve this. Thanks in advance.
Apr 29, 2016 at 08:03 AM, mani24991 answered with:
Thanks @Vince Jason Soliza and @Alok Verma,
Another scenario which worked for me is, #[payload.resultSet !=empty ]
Apr 28, 2016 at 12:13 PM, vinzonwsl answered with:
Hi @Manikandan,
Hope this example flow could help you.
<http:listener-config name="HTTP_Listener_Configuration"
host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration" />
<flow name="3.7.3-dataweaveFlow">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/forum" doc:name="HTTP" allowedMethods="GET" />
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
{
resultSet1: []
}]]></dw:set-payload>
</dw:transform-message>
<choice doc:name="Choice">
<when expression="#[payload.resultSet1.size() == 0]">
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
{
resultSet1: "empty"
}]]></dw:set-payload>
</dw:transform-message>
</when>
<otherwise>
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
{
resultSet1: "not empty"
}]]></dw:set-payload>
</dw:transform-message>
</otherwise>
</choice>
<!-- here i'm getting error , i need to give this json payload as soap
message -->
<!-- Here i need to consume soap message -->
</flow>
Cheers,
Apr 28, 2016 at 03:39 PM, alok_annu answered with:
For null check use this. #[payload is org.mule.transport.NullPayload]
May 13, 2016 at 07:47 AM, stalwar answered with:
[!(payload is org.mule.transport.NullPayload)] would work for u
May 13, 2016 at 08:23 AM, sureshtonne answered with:
If its ArrayList then you have to add MEL as #[payload.size() !=0]