|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Esql Select Transformation |
« View previous topic :: View next topic » |
Author |
Message
|
adubya |
Posted: Thu Feb 23, 2017 12:56 am Post subject: |
|
|
Partisan
Joined: 25 Aug 2011 Posts: 377 Location: GU12, UK
|
I tried, and failed, to achieve your goal using one SELECT statement _________________ Independent Middleware Consultant
andy@knownentity.com |
|
Back to top |
|
|
rekarm01 |
Posted: Sat Feb 25, 2017 6:38 pm Post subject: Re: Esql Select Transformation |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
adubya wrote: |
I tried, and failed, to achieve your goal using one SELECT statement |
It seems like this should have worked:
Code: |
SET OutputRoot.XMLNSC.Output.LineItem[] = SELECT L.LineNum AS LineNum, A AS AssociatedLineNum
FROM InputRoot.XMLNSC.Order.LineItem[] AS L, L.AssociatedLineNums.AssociatedLineNum[] AS A; |
But since the behavior of nested lists in a FROM clause is not well documented, who knows what it should have done?
What it does instead is to abort the selection at the first occurrence of LineItem where AssociatedLineNum[] is an empty list. One way to work around that problem is to add another SELECT call to filter out the empty lists.
Don't try to get too clever with the SELECT function though; sometimes it's better to just use a loop instead. The syntax of the FOR loop might be a bit mixed up, (should it be "value(s) AS variable", or "variable AS value(s)"?), but at least its behavior is well documented. |
|
Back to top |
|
|
smdavies99 |
Posted: Sat Feb 25, 2017 10:55 pm Post subject: Re: Esql Select Transformation |
|
|
Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
rekarm01 wrote: |
Don't try to get too clever with the SELECT function though; sometimes it's better to just use a loop instead. The syntax of the FOR loop might be a bit mixed up, (should it be "value(s) AS variable", or "variable AS value(s)"?), but at least its behavior is well documented. |
I have found in 40+ years of software development that KISS rules ok (Keep it simple stupid)
Just think for a moment about the person who has to maintain your code. Can they understand and if needed make changes to your nested select?
The two step solution with appropriate comments is IMHO the way to go. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
|
|
|
|
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
|
|
|
|