ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Mapping Node - Grouping issue

Post new topic  Reply to topic
 Mapping Node - Grouping issue « View previous topic :: View next topic » 
Author Message
paulym
PostPosted: Sun Feb 24, 2013 10:24 pm    Post subject: Mapping Node - Grouping issue Reply with quote

Newbie

Joined: 24 Feb 2013
Posts: 4

Hi,

I have created a flow which maps an XML message to CSV using Broker 6.1. The XML format is as follows (note group2 and group3 are unbounded):

Code:

<xml>
    <field1>data1</field1>
    <group1>
        <group2>
            <field2>data2</field2>
            <field3>data3</field3>
        </group2>
        <group2>
            <field2>data4</field2>
            <field3>data5</field3>
        </group2>
        <group2>
            <field2>data6</field2>
            <field3>data7</field3>
        </group2>
    </group1>
    <group3>
            <field4>data8</field4>
            <field5>data9</field5>
    </group3>
    <group3>
            <field4>data10</field4>
            <field5>data11</field5>
    </group3>
</xml>


And the CSV output should be:

Code:

data1,data2,data3,data8,data9,data10,data11
data1,data4,data5,data8,data9,data10,data11
data1,data6,data7,data8,data9,data10,data11


But is currently:

Code:

data1,data2,data3
data1,data4,data5
data1,data6,data7


So basically group2 dictates the rows and group3 is grouped horizontally. Currently I have it working so the first 3 fields are populating correctly over the 3 rows, but I'm struggling to perform the grouping horizontally.

My mapping node in the spreadsheet has a for loop over group2. I tried adding another for loop further down the list for group3, but this just overwrote the last two fields through the loop, rather than stacking them horizontally.

Does anyone have any suggestions? I have a feeling it is something to do with Groups in the message set.

Thanks,
Paul.
Back to top
View user's profile Send private message
paulym
PostPosted: Mon Feb 25, 2013 1:05 pm    Post subject: Reply with quote

Newbie

Joined: 24 Feb 2013
Posts: 4

Has anyone tried this? I gathered it was possible from the CSV2XML sample that comes with the toolkit, but unfortunately there isn't much doco on the mapping node.

Thanks,
Paul
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Feb 25, 2013 2:55 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Is there a special reason why you need to use the Mapping node for this? Some ESQL SET statements in a loop ( using REFERENCE variables, of course ), or a carefully-constructed ESQL SELECT statement could do the job quite simply.
Back to top
View user's profile Send private message
paulym
PostPosted: Mon Feb 25, 2013 3:54 pm    Post subject: Reply with quote

Newbie

Joined: 24 Feb 2013
Posts: 4

The reason I've gone with this rather than simply ESQL is to gain the ability to visualize the mappings. The incoming XML is quite complex and the specifications change yearly, also, the outgoing CSV to the client is likely to change as they request different data. This will allow a developer in the future to quickly remap fields without trawling through code.
Back to top
View user's profile Send private message
paulym
PostPosted: Mon Feb 25, 2013 4:12 pm    Post subject: Reply with quote

Newbie

Joined: 24 Feb 2013
Posts: 4

Worked it out. For anyone else that needs to do this:

1) Under the CVS message set, create a group under Groups.
2) Add the elements required to this new group (in my case, with the XML sample below, field4 and field5)
3) Under Messages right click the appropriate row under your message and select Add Group Reference, select your new group
4) Fix the cardinality (i.e. set Max Occurs to -1 as there can be any number)
5) Under the Mapping Node drag out the fields from XML to CVS
6) In the spreadsheet you will probably need to delete the new For loop created, as it will be out of place and create new rows instead of groups
7) Highlight the new mappings in the spreadsheet and right click and select For
8 ) Set the For condition to the group in question (in my case $source/xml/group3)

This will build out the CSV correctly.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Mapping Node - Grouping issue
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.