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 » Problem with updating list/repeating structure in wbimb/esql

Post new topic  Reply to topic
 Problem with updating list/repeating structure in wbimb/esql « View previous topic :: View next topic » 
Author Message
pank2210
PostPosted: Tue Apr 18, 2006 1:13 am    Post subject: Problem with updating list/repeating structure in wbimb/esql Reply with quote

Newbie

Joined: 26 Feb 2006
Posts: 1
Location: Mumbai

Hi,

Can some one help to find solution for below mention problem.
I have a list strucutre in a XML (repeating compund structure at some point in input tree) and i have to update a particular list item based on the content of its element.
let say if i have
<myRoot>
<child1>
<a>1</a>
<b>1</b>
<c>1</c>
</child1>
<child1>
<a>2</a>
<b>2</b>
<c>2</c>
</child1>
<child1>
<a>3</a>
<b>3</b>
<c>3</c>
</child1>
<child1>
<a>4</a>
<b>4</b>
<c>4</c>
</child1>
</myRoot>

then can write some thing like this and i want set child1.a to 10 where child1.c=3
------------
declare ref reference to select T.* from OutputRoot.XML.myRoot.child1[] where T.c = 3;
if LASTMOVE then
SET ref.a=10;
end if;
-----------

In short can reference a data dynamically retrieved by select i any logical structure.

other wise to achieve this i need do following code which migth be cubersome perhaps no efficient
--------------------
declare cnt=1;
while cnt <= cardinality(OutputRoot.XML.myRoot.child1[] ) do
if InputRoot.XML.myRoot.child1[cnt] = 3 then
SET InputRoot.XML.myRoot.child1[cnt] = 10;
end if;
end while;
--------------------

Or is there any efficient way to implement solution without using select.

Thanks,
Pankaj.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
elvis_gn
PostPosted: Tue Apr 18, 2006 1:56 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi pank2210,

Your first snippet using reference is good. You should continue in that line.

You are accessing the OutputRoot.XML....why ?
You could rather fetch from the InputRoot itself and then copy the altered ref to the OutputRoot.

Also the check for LASTMOVE will only return true if you have done a MOVE before...I am not sure if DECLARE is equivalent to MOVE...
else you could simply point to the first instance of child1
Code:
declare ref reference to select T.* from OutputRoot.XML.myRoot.child1

and then MOVE IF ref.c=10....your LASTMOVE will then make sense.

Regards.
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 » Problem with updating list/repeating structure in wbimb/esql
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.