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 » Transform array message

Post new topic  Reply to topic
 Transform array message « View previous topic :: View next topic » 
Author Message
gecs
PostPosted: Thu Sep 03, 2009 11:26 am    Post subject: Transform array message Reply with quote

Acolyte

Joined: 14 Nov 2007
Posts: 58

Hi everybody, some knows how to get solution below:
Input:
Code:

Root
  - MRM
    - Tarjeta1
      - Cuenta A
      - Cuenta B
      - Cuenta C
      - Cuenta D
    - Tarjeta2
      - Cuenta E
      - Cuenta F
      - Cuenta G
    - Tarjeta... (n)
      - Cuenta... (m)
      - Cuenta... (o)
      - Cuenta... (p)
     .
     .
     .


Output:
Code:

Root
 - MRM
    - Cuentas
       - Cuenta A
       - Cuenta B
       - Cuenta E
       - Cuenta G


How can I do this without using LOOP, FOR, WHILE, REPEAT sentences.
Is there any solution using SELECT?

Thanks.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 03, 2009 11:29 am    Post subject: Re: Transform array message Reply with quote

Grand High Poobah

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

gecs wrote:
How can I do this without using LOOP, FOR, WHILE, REPEAT sentences.
Is there any solution using SELECT?


What's the opposition to loop constructs?

What are the criteria for inclusion in the output? Why are C, D & F excluded?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
gecs
PostPosted: Thu Sep 03, 2009 12:58 pm    Post subject: Re: Transform array message Reply with quote

Acolyte

Joined: 14 Nov 2007
Posts: 58

[quote="Vitor"]
gecs wrote:
How can I do this without using LOOP, FOR, WHILE, REPEAT sentences.
Is there any solution using SELECT?
Back to top
View user's profile Send private message
gecs
PostPosted: Thu Sep 03, 2009 1:00 pm    Post subject: Reply with quote

Acolyte

Joined: 14 Nov 2007
Posts: 58

What's the opposition to loop constructs?

What are the criteria for inclusion in the output? Why are C, D & F excluded?[/quote]

the opposition? anything.
the criteria? it doesn't matter, ouput can contain the other excluded elements...

the out put can be:

Quote:

Root
- MRM
- Cuentas
- Cuenta A
- Cuenta B
- Cuenta C
- Cuenta D
- Cuenta E
- Cuenta F
- Cuenta G
- Cuenta (m)
- Cuenta (o)
- Cuenta (p)
- ....
- ....
- ....



I'm only want to know if is possible get the output without using LOOP sentences... some like this:

Quote:
SET OutputRoot.MRM.Cuentas.Cuenta[] = SELECT * FROM InputRoot.MRM.Tarjeta.Cuenta[] AS C;


but this only get the fields "Cuenta" of one(the first) ocurrence of "Tarjeta". How can I do to get the rest in the same output?

thanks... for your time...
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 03, 2009 1:09 pm    Post subject: Reply with quote

Grand High Poobah

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

gecs wrote:
I'm only want to know if is possible get the output without using LOOP sentences... some like this:

Quote:
SET OutputRoot.MRM.Cuentas.Cuenta[] = SELECT * FROM InputRoot.MRM.Tarjeta.Cuenta[] AS C;


but this only get the fields "Cuenta" of one(the first) ocurrence of "Tarjeta".


Yes, it is, using something like that.

You might well find that, depending on the complexity of the inclusion/exclusion criteria, a loop will be easier to maintain.

I'd doubt there's much performance difference between a SELECT and a properly written loop. I welcome comments on this.

(By "properly written" I explicitly exclude anything including anything like

Code:

SET OutputRoot.MRM.Cuentas.Cuenta[I] = InputRoot.MRM.Tarjeta.Cuenta[I];
SET I = I + 1;

)
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Sep 03, 2009 1:27 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
gecs wrote:
I'm only want to know if is possible get the output without using LOOP sentences... some like this:

Quote:
SET OutputRoot.MRM.Cuentas.Cuenta[] = SELECT * FROM InputRoot.MRM.Tarjeta.Cuenta[] AS C;


but this only get the fields "Cuenta" of one(the first) ocurrence of "Tarjeta".


Yes, it is, using something like that.


Of course, it would have to be proper ESQL SELECT syntax, which the example shown is not.

Presumably gecs has the correct syntax in the ESQL file that is correctly generating the result mentioned (which is different than the result desired).

Gecs - you can get the result you want by a very simple, very straight forward change to the corrected syntax version of your SELECT statement. All you need to change is your FROM and what you are selecting.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 03, 2009 1:47 pm    Post subject: Reply with quote

Grand High Poobah

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

mqjeff wrote:
Of course, it would have to be proper ESQL SELECT syntax, which the example shown is not.


Hence my use of the phrase "something like"
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Transform array message
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.