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 : Target messages sourced from a database

Post new topic  Reply to topic
 Mapping node : Target messages sourced from a database « View previous topic :: View next topic » 
Author Message
Cogito-Ergo-Sum
PostPosted: Fri Feb 04, 2011 3:09 am    Post subject: Mapping node : Target messages sourced from a database Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

How do you get the Mapping node to get multiple target messages depending on the rows returned by a database select ?

I have read the documentation , confirmed that the database table does have multiple rows for the SELECT criterion and yet I keep getting a single message as the output. In Map Script, I have $db:select set to match the value of the input message. There is a 'for' row immediately below $db:select whose value I have set to $db:select. I am unable to make the $target a child of this 'for'. I think, this is required to get multiple messages as described in this link.

Excerpt:
Quote:
The behavior of the map is determined by the position of the 'for' row in the Spreadsheet pane. For example, if the results of the $db:select statement matched five rows in the database, and the 'for' row is the parent of the $target entry in the Spreadsheet pane, five complete messages are generated by the mapping node. If the 'for' row is positioned within the message body, one message is generated with five repeating elements in the message body.


Thus, I went ahead with population of the elements under $target. The build et al goes fine but when I run the flow, I get only a single message in output.

What am I missing ?
_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
fatherjack
PostPosted: Fri Feb 04, 2011 3:22 am    Post subject: Re: Mapping node : Target messages sourced from a database Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

Cogito-Ergo-Sum wrote:
What am I missing ?


Can't say as I haven't seen your mapping node and map script. However, from experience it can be quite tricky to get your 'for' loops in the right place in the mapping node. I much prefer to use a compute node and propagate the messages from the ESQL code.
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Fri Feb 04, 2011 3:31 am    Post subject: Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

Quote:
I much prefer to use a compute node and propagate the messages from the ESQL code.

I might do the same, eventually. But, it would have been nice to get the Mapping node without having to pull out hair...
_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
fatherjack
PostPosted: Fri Feb 04, 2011 3:58 am    Post subject: Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

Cogito-Ergo-Sum wrote:
Quote:
I much prefer to use a compute node and propagate the messages from the ESQL code.

I might do the same, eventually. But, it would have been nice to get the Mapping node without having to pull out hair...


In the spreadsheet pane of the mapping msgmap what is the sequence of the mapping statements?
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
fatherjack
PostPosted: Fri Feb 04, 2011 5:44 am    Post subject: Re: Mapping node : Target messages sourced from a database Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

Cogito-Ergo-Sum wrote:
I am unable to make the $target a child of this 'for'.


Right click $target and then select 'for'. Then enter $db:select in the Value field. It's much harder (impossible?) to do using drag and drop.
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Fri Feb 04, 2011 5:57 am    Post subject: Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

Quote:
In the spreadsheet pane of the mapping msgmap what is the sequence of the mapping statements?

There are two sources - $source and $db:select

    First, $db:select, whose value is set to a $source element.
    $db:select has a child 'for' whose value is set to $db:select.
    $target (at the same level as $db:select)
    $target has a child Properties set to $source/Properties
    $target has another child which is a message type. The children of this message type has been mapped from $source.

_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
fatherjack
PostPosted: Fri Feb 04, 2011 6:01 am    Post subject: Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

Cogito-Ergo-Sum wrote:
$target (at the same level as db:select)


That could be the problem. Try dragging the $target onto the 'for'.
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Fri Feb 04, 2011 6:06 am    Post subject: Re: Mapping node : Target messages sourced from a database Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

Quote:
Right click $target and then select 'for'. Then enter $db:select in the Value field. It's much harder (impossible?) to do using drag and drop.

It was one of my earliest attempt. That makes $db:select out of scope.

I also tried the following.
    Select an element under $target.
    Select an element under $db:select.
    Right-click and select 'Map from source'.
    Mapping is done by Toolkit automagically such that $db:select - with for as it's child - somewhere under $target.


But, multiple messages do not appear.
_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Fri Feb 04, 2011 6:13 am    Post subject: SOLVED Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

ok, I got it !!

Removed $db:select. Selected $target, right-clicky-clicky, then clicky-clicky 'Select Data Source...'. This creates new $db:select a 'for' child and then $target as its child. And so, everything working now !


_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Feb 04, 2011 6:16 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If I understand the issue, you want to do two things:
  1. Iterate over the rows that are returned from the database
  2. Transform the row into different types of output messages based on the contents of the row


Is that correct?

To accomplish #1, you need to use the For macro, as El Padre Borracho suggests.

To accomplish #2, you likely need to use an if and submaps.
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Fri Feb 04, 2011 6:23 am    Post subject: Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

The first item is required; and, I solved it only recently.

El Padre Borracho ? muchos apologies, my espanol not good. But, is that Father Drunkard ??
_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Feb 04, 2011 6:43 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Cogito-Ergo-Sum wrote:
The first item is required; and, I solved it only recently.


Yes, you posted that you solved it whilst I was writing my post.

Cogito-Ergo-Sum wrote:
El Padre Borracho ? muchos apologies, my espanol not good. But, is that Father Drunkard ??

Ich spreche keine espanol myself. But, yes, Father Drunkard. "Father jack" is a character from a British TV show, who is famous for drinking all the time, and fatherjack who posts here tries to live up to the name, at least whilst posting here.

Having not met the chap, I can't say if it's true in real life. But if we're ever in the same bar in the same country, the first round's on me and damned be he that first cries Hold, Enough!
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Fri Feb 04, 2011 7:54 am    Post subject: Reply with quote

Master

Joined: 07 Feb 2006
Posts: 293
Location: Bengaluru, India

Quote:
Ich spreche keine espanol myself
Das ist Duestch ?

Yes, wikipedia told me about Father Jack.


_________________
ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Feb 04, 2011 7:57 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Cogito-Ergo-Sum wrote:
Quote:
Ich spreche keine espanol myself
Das ist Duestch ?


Only as much as my Spanish was Spanish. (also, Deutche, I believe)
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Feb 04, 2011 8:55 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

mqjeff wrote:
Cogito-Ergo-Sum wrote:
Quote:
Ich spreche keine espanol myself
Das ist Duestch ?


Only as much as my Spanish was Spanish. (also, Deutche, I believe)


Deutsch for the non foreign language challenged.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
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 : Target messages sourced from a database
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.