|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Doubt regarding Null checks in ESQL |
« View previous topic :: View next topic » |
Author |
Message
|
shushruthkumar |
Posted: Wed May 05, 2021 3:48 am Post subject: Doubt regarding Null checks in ESQL |
|
|
Newbie
Joined: 05 May 2021 Posts: 2
|
Hi,
I am doing one of the Null checks for the Rest API being developed.
ESQl code :
IF COALESCE(InputLocalEnvironment.HTTP.Input.QueryString.accountId) IS NOT NULL THEN
SET OutputRoot.JSON.Data.accountId = InputLocalEnvironment.HTTP.Input.QueryString.accountId;
...........
In above condition I am doing the null check for query param of a Rest Service.
while hitting a service from postman, I am passing the query param value as NULL
here the above condition should fail right, as coalesce will retrun NULL and NULL is NOT NULL should fail right but here the condition is getting executed as true and going through IF and retruning the result.
Can anyone suggests me here? |
|
Back to top |
|
 |
timber |
Posted: Wed May 05, 2021 6:41 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
|
Back to top |
|
 |
timber |
Posted: Thu May 06, 2021 9:13 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Looking at this again, I suspect the answer might be more complex than I thought. Two important questions:
- Why are you using COALESCE with only 1 argument? Why not just test for IS NOT NULL directly?
- More importantly, how exactly are you passing the value NULL via Postman? Have you checked (in the debugger, or using a Trace node) that the value NULL is being received in your message flow? |
|
Back to top |
|
 |
rekarm01 |
Posted: Fri May 07, 2021 10:04 am Post subject: Re: Doubt regarding Null checks in ESQL |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
timber wrote: |
Have you checked (in the debugger, or using a Trace node) that the value NULL is being received in your message flow? |
Also, enabling a debug-level usertrace may be useful. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|