|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Is this a correct use of graphical maps with for each |
« View previous topic :: View next topic » |
Author |
Message
|
bdaoust |
Posted: Wed Aug 19, 2015 10:29 am Post subject: Is this a correct use of graphical maps with for each |
|
|
Centurion
Joined: 23 Sep 2010 Posts: 130
|
Hello all.
We have an existing message flow that takes mainframe data, converts to XML and sends it to an output queue for processing. It's been in place and all is well.
There is a new requirement to take that same XML and create a new output that will be XML based on values from the original data.
The original XML has a node that can repeat one or more times.
Ex
Code: |
<ElementDetails>
Short Description
DollarValue
other elements
</ElementDetails> |
So I need to iterate though all of ElementDetails and transform to a new output field based on conditions.
I have this working by using a graphical map - with ElementDetails connect to the Root Level of the resulting XML. This creates a For Each. Withing the for each, I wire ShortDescription and PremiumTotal to an element in my output (target) XML. For instance the target element might be called BookPremium. So I do a condition on the IF to see if ShortDescription contains 'Book' If it does - the transforms occurs, which is to move PremiumTotal to an element called BookPremiumTotal in the target XML.
I could have multiple conditions that I need to check which each TRUE condition would result in a MOVE transform to a specifically named element in the resulting XML. Ex Books, Movies, Games, etc.
The way I got this working is to wire ShortDescription and PremiumTotal to all of the possible elements in the target XML and define the conditions. This could result in many (so far 20) different wires. This is because a) each transform is looking for a specific condition and each transforms needs to go to a specific element in the target XML.
While this is working, it seems like it could be a maintenance nightmare. I think I could do the same thing in ESQL which would be much easier to maintain as the code would be all one module.
Thoughts? I'm open to other approaches even if it's something I haven't done. Always willing to learn good approaches. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Aug 19, 2015 10:43 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If you've got one value that determines which output element(s) to create, there's nothing you can do other than have a huge set of wires.
I don't remember, but I thought there was a map node "case" kind of statement, instead of writing lots of IF/ELSE... |
|
Back to top |
|
 |
bdaoust |
Posted: Wed Aug 19, 2015 12:18 pm Post subject: |
|
|
Centurion
Joined: 23 Sep 2010 Posts: 130
|
Thanks for the reply mqjeff.
I didn't see a case option in the graphical map. Another thing I hate - is that if I do a huge set of wires - there is no way I can see to put a label on them. So I have a huge list of IF and ELSE IFs and if something needs to be maintained in the future, you would need to click through them. I know you can look a the .MAP file in the workspace, but not sure if editing that is frowned upon. I remember in WMB7 the map script was nice because you could change things there are well. Is the map script gone in IIB9?
I'm thinking compute node is the way to go on this. All one self contained module that would be easy to edit in the future. I be interested in others here agree?
I should say the resulting XML will most likely be parsed out to a DB so an SSRS report can be built around the data. Having said that, perhaps storing the original XML from IIB9 into the database and having all the work done in a stored procedure on the database side is a better approach. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Aug 19, 2015 12:23 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bdaoust wrote: |
Is the map script gone in IIB9? |
Yes, and no-one misses it. It was ESQL so bad my cat would be ashamed to own it. In v9 the map is a compiled object.
bdaoust wrote: |
I'm thinking compute node is the way to go on this. All one self contained module that would be easy to edit in the future. I be interested in others here agree? |
Why have you discounted a ESQL function called from the map?
bdaoust wrote: |
I should say the resulting XML will most likely be parsed out to a DB so an SSRS report can be built around the data. Having said that, perhaps storing the original XML from IIB9 into the database and having all the work done in a stored procedure on the database side is a better approach. |
It's an option.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
harveystanford |
Posted: Fri Aug 21, 2015 1:02 am Post subject: |
|
|
Newbie
Joined: 21 Aug 2015 Posts: 1
|
All one self contained module that would be easy to edit in the future. |
|
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
|
|
|
|