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 » Adding new elements into an existing element with ESQL

Post new topic  Reply to topic
 Adding new elements into an existing element with ESQL « View previous topic :: View next topic » 
Author Message
omatan234
PostPosted: Mon Jun 12, 2017 11:17 am    Post subject: Adding new elements into an existing element with ESQL Reply with quote

Newbie

Joined: 12 Jun 2017
Posts: 8

I Have this element in XML for exmple:

<Apple>
<age>2</age>
<size>6</size>
</Apple>

and i have a reference to number of elements that i want to insert under the 'size' element in ESQL without loops.

In the end, for reference to elements like:

<shape>round</shape>
<color>red</color>
<origin>fruit<origin>


the final result spouse to be:

<Apple>
<age>2</age>
<size>6</size>
<shape>round</shape>
<color>red</color>
<origin>fruit<origin>
</Apple>
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jun 12, 2017 11:36 am    Post subject: Re: Adding new elements into an existing element with ESQL Reply with quote

Grand High Poobah

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

omatan234 wrote:
i have a reference to number of elements that i want to insert under the 'size' element in ESQL without loops.


Why would you need a loop?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Jun 12, 2017 11:39 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

What requirements would possibly indicate that you should or should not use loops?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
omatan234
PostPosted: Mon Jun 12, 2017 9:49 pm    Post subject: Reply with quote

Newbie

Joined: 12 Jun 2017
Posts: 8

I thought of moving the new elements one by one with a loop (the number of elements is not constant and that's why i said loop) but i want to insert them in a singel command.
Is there any way to do it ?
Back to top
View user's profile Send private message
timber
PostPosted: Mon Jun 12, 2017 11:51 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

I assume you were hoping for something like a Perl slice, where you can add a list of elements to an array in one statement. ESQL does not have that facility.

I know you don't want to use a loop, but...
Code:
FOR refSource AS sourceElement.*[] DO
    CREATE LASTCHILD OF refDestination FROM refSource
END FOR;
I don't think that's too bad.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jun 13, 2017 3:53 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

timber wrote:
I assume you were hoping for something like a Perl slice, where you can add a list of elements to an array in one statement. ESQL does not have that facility

I suspect that someone else might suggest a SELECT statement.

But that's complicated and messy and hard to read and debug, so there's no strong reason to use it instead of a loop.
_________________
chmod -R ugo-wx /
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 » Adding new elements into an existing element with 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.