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 » Query in SELECT ITEM function

Post new topic  Reply to topic
 Query in SELECT ITEM function « View previous topic :: View next topic » 
Author Message
kash3338
PostPosted: Sat Sep 24, 2011 10:23 am    Post subject: Query in SELECT ITEM function Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Hi,

I have an Input in which a particular element is repeating and the NAME value of each element is Unique. I need to fetch one particular NAME value and transform and map it to corresponding NAME in output. The Input and Output message are same except for this transformed value.

I use the SELECT ITEM statement to fetch the element using the WHERE clause. I need to know from which array subscript the element was fetched (the number). For example,

My Input:

<Root>
<EMP>
<Name>ABC</Name>
</EMP>
<EMP>
<Name>XYZ</Name>
</EMP>
<EMP>
<Name>DEF</Name>
</EMP>
</Root>



My Output:

<Root>
<EMP>
<Name>ABC</Name>
</EMP>
<EMP>
<Name>XYZ</Name>
</EMP>
<EMP>
<Name>DEF<TIMESTAMP></Name>
</EMP>
</Root>

My Input and Output are same, but for the element with Name as "DEF" I have to append the TIMESTAMP and send it.

I fetch the Value DEF using the SELECT ITEM function, but in Output I need to know the subscript so that I can directly insert the value to that subscript.

I copy the Entire message initially. This SELECT ITEM is done to avoid unnecessary loops in my code as the actual message is too large. Any suggestions will be helpful.

Also I would like to know if INSERT Selections will be helpful here?
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sat Sep 24, 2011 8:48 pm    Post subject: Reply with quote

Grand High Poobah

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

You mean to say you wouldn't be using references and move ref next sibling, if lastmove(ref) for your looping?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Sat Sep 24, 2011 9:34 pm    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

fjb_saper wrote:
You mean to say you wouldn't be using references and move ref next sibling, if lastmove(ref) for your looping?


I dont want to loop the XML since there would be lot of repeating elements and SELECT ITEM seems to be the best choice. But how do i get to know the Index where my element was found when using SELECT ITEM?
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sun Sep 25, 2011 7:08 am    Post subject: Reply with quote

Grand High Poobah

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

It would help quite a bit, if you specified
What your input looks like (full path for repeat)
what your output looks like
your select statement
Why you need the row number of your DEF value.

I am still convinced that it would be far quicker to use a loop on a reference, moving it to next sibling until done..., especially if you have multiple DEF values in your output.

This can be done on the output.

Have you looked at the special index values for first, last etc...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Sun Sep 25, 2011 8:33 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

fjb_saper wrote:

Why you need the row number of your DEF value.


I need this because my Input and Output are same except for adding timestamp for DEF alone.

fjb_saper wrote:

I am still convinced that it would be far quicker to use a loop on a reference, moving it to next sibling until done..., especially if you have multiple DEF values in your output.


I just have only one DEF in my Input for sure and hence SELECT is more efficient.

fjb_saper wrote:

This can be done on the output.

Have you looked at the special index values for first, last etc...


Can you please explain this more?
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sun Sep 25, 2011 12:47 pm    Post subject: Reply with quote

Grand High Poobah

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

kash3338 wrote:


fjb_saper wrote:

This can be done on the output.

Have you looked at the special index values for first, last etc...


Can you please explain this more?


the manual, look for [<], [>], [*] and their special meanings...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Sun Sep 25, 2011 2:14 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

fjb_saper wrote:
the manual, look for [<], [>], [*] and their special meanings...


Rather assumes this DEF tag is in a known position (as I agree it is in the example shown). So if it's known to be the first, or the last, or the nth, then we're good.

But then I suspect the OP wouldn't have been made.

If it is indeed at some random position inside the document, your best best may well be to sacrifice the single select and loop as my worthy associate suggests.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kash3338
PostPosted: Mon Sep 26, 2011 8:55 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Yes the position of DEF is random.

I just want to know what the use of this INSERT Selection is?

INSERT Selection is given in a small part here,

http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fak05620_.htm

There is no example given anywhere about this, but just a small description. Can anyone explain this? Any examples on how to implement in XML will be very helpful.
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Sep 26, 2011 9:49 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I would suggest that this is a situation where use of an XPath expression would be of some value, but in general it might require that you use Java and if you don't know Java, then don't go down that road.

Also you should examine the notion of "unnecessary loops". For one thing, use of a SELECT may cause a loop to be performed under the covers. And so by using it, you are not avoiding a loop - you are merely avoiding the explicit statement of the loop.

For another thing, there is the whole question of what makes a loop necessary or unnecessary.
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 » Query in SELECT ITEM function
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.