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 » How to select a value based on the attribute value

Post new topic  Reply to topic
 How to select a value based on the attribute value « View previous topic :: View next topic » 
Author Message
Sourya
PostPosted: Tue Aug 04, 2015 10:55 pm    Post subject: How to select a value based on the attribute value Reply with quote

Newbie

Joined: 29 Jan 2015
Posts: 5

Hello,

I am trying to get the last name that is "Doe" from the below message.

We have a message like this.

Code:
<Customer>
 <CustomerID>1</CustomerID>
 <CustomerName>
  <Salutation>Mr.</Salutation>
  <Name Location="First">John</Name>
  <Name Location="Last">Doe</Name>
  <FullName>John Doe</FullName>
 </CustomerName>
</Customer>


Can you please help?
Back to top
View user's profile Send private message
maurito
PostPosted: Tue Aug 04, 2015 11:53 pm    Post subject: Re: How to select a value based on the attribute value Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

Sourya wrote:
Hello,

I am trying to get the last name that is "Doe" from the below message.

We have a message like this.

Code:
<Customer>
 <CustomerID>1</CustomerID>
 <CustomerName>
  <Salutation>Mr.</Salutation>
  <Name Location="First">John</Name>
  <Name Location="Last">Doe</Name>
  <FullName>John Doe</FullName>
 </CustomerName>
</Customer>


Can you please help?

what have you tried?. what documentation have you read? have you searched this forum ? similar questions have been asked before.
Back to top
View user's profile Send private message
Sourya
PostPosted: Wed Aug 05, 2015 12:17 am    Post subject: Re: How to select a value based on the attribute value Reply with quote

Newbie

Joined: 29 Jan 2015
Posts: 5

maurito wrote:
Sourya wrote:
Hello,

I am trying to get the last name that is "Doe" from the below message.

We have a message like this.

Code:
<Customer>
 <CustomerID>1</CustomerID>
 <CustomerName>
  <Salutation>Mr.</Salutation>
  <Name Location="First">John</Name>
  <Name Location="Last">Doe</Name>
  <FullName>John Doe</FullName>
 </CustomerName>
</Customer>


Can you please help?

what have you tried?. what documentation have you read? have you searched this forum ? similar questions have been asked before.



Hi,


I am trying this

DECLARE cln CHARACTER '';

SET cln = THE(SELECT C.Name FROM InputRoot.XMLNSC.Customer.CustomerName as C WHERE C.Name.(XML.Attribute)Location = 'Last');
Back to top
View user's profile Send private message
maurito
PostPosted: Wed Aug 05, 2015 12:36 am    Post subject: Re: How to select a value based on the attribute value Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

if you are using the XMLNSC domain ( which you are ), XML.Attribute is not valid, you should use XMLNSC.Attribute.
You may also need the ITEM keyword in your SELECT statement
Back to top
View user's profile Send private message
Sourya
PostPosted: Wed Aug 05, 2015 1:01 am    Post subject: Re: How to select a value based on the attribute value Reply with quote

Newbie

Joined: 29 Jan 2015
Posts: 5

maurito wrote:
if you are using the XMLNSC domain ( which you are ), XML.Attribute is not valid, you should use XMLNSC.Attribute.
You may also need the ITEM keyword in your SELECT statement


Hi,

Tried this but did not work.

SET cln = SELECT ITEM C.Name FROM InputRoot.XMLNSC.Customer.CustomerName as C WHERE C.Name.(XMLNSC.Attribute)Location = 'Last';

SET OutputRoot.XMLNSC.Customer.LastName = cln;

The output formed like this:
<Customer/>
Back to top
View user's profile Send private message
maurito
PostPosted: Wed Aug 05, 2015 1:24 am    Post subject: Re: How to select a value based on the attribute value Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

Sourya wrote:
maurito wrote:
if you are using the XMLNSC domain ( which you are ), XML.Attribute is not valid, you should use XMLNSC.Attribute.
You may also need the ITEM keyword in your SELECT statement


Hi,

Tried this but did not work.

SET cln = SELECT ITEM C.Name FROM InputRoot.XMLNSC.Customer.CustomerName as C WHERE C.Name.(XMLNSC.Attribute)Location = 'Last';

SET OutputRoot.XMLNSC.Customer.LastName = cln;

The output formed like this:
<Customer/>


because the path in the select statement is not pointing to the right place. You need to learn to debug the problems on your own, use a user trace with -l debug, etc.

Hint: do you know what [] means in a path ?
Back to top
View user's profile Send private message
Sourya
PostPosted: Wed Aug 05, 2015 2:22 am    Post subject: Re: How to select a value based on the attribute value Reply with quote

Newbie

Joined: 29 Jan 2015
Posts: 5

maurito wrote:
Sourya wrote:
maurito wrote:
if you are using the XMLNSC domain ( which you are ), XML.Attribute is not valid, you should use XMLNSC.Attribute.
You may also need the ITEM keyword in your SELECT statement


Hi,

Tried this but did not work.

SET cln = SELECT ITEM C.Name FROM InputRoot.XMLNSC.Customer.CustomerName as C WHERE C.Name.(XMLNSC.Attribute)Location = 'Last';

SET OutputRoot.XMLNSC.Customer.LastName = cln;

The output formed like this:
<Customer/>


because the path in the select statement is not pointing to the right place. You need to learn to debug the problems on your own, use a user trace with -l debug, etc.

Hint: do you know what [] means in a path ?



Hi,

I have already used the debug. My input message is like this:

Code:
<Customer>
  <CustomerID>1</CustomerID>
  <CustomerName>
    <Salutation>Mr.</Salutation>
    <Name Location="First">John</Name>
    <Name Location="Last">Doe</Name>
    <FullName>John Doe</FullName>
  </CustomerName>
</Customer>



Observed a strange thing:

The reference C that is created after executing the SELECT does not have the attributes as in the InputRoot.

Code:
C
   Salutation:CHARACTER:Mr.
   Name:CHARACTER:John
   Name:CHARACTER:Doe
   FullName:CHARACTER:John Doe

Customer
   CustomerID:CHARACTER:1
   CustomerName
         Salutation:CHARACTER:Mr.
         Name:CHARACTER:John
               Location:CHARACTER:First
         Name:CHARACTER:Doe
               Location:CHARACTER:Last
         FullName:CHARACTER:John Doe
Back to top
View user's profile Send private message
maurito
PostPosted: Wed Aug 05, 2015 2:30 am    Post subject: Re: How to select a value based on the attribute value Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

Sourya wrote:
maurito wrote:
Sourya wrote:
maurito wrote:
if you are using the XMLNSC domain ( which you are ), XML.Attribute is not valid, you should use XMLNSC.Attribute.
You may also need the ITEM keyword in your SELECT statement


Hi,

Tried this but did not work.

SET cln = SELECT ITEM C.Name FROM InputRoot.XMLNSC.Customer.CustomerName as C WHERE C.Name.(XMLNSC.Attribute)Location = 'Last';

SET OutputRoot.XMLNSC.Customer.LastName = cln;

The output formed like this:
<Customer/>


because the path in the select statement is not pointing to the right place. You need to learn to debug the problems on your own, use a user trace with -l debug, etc.

Hint: do you know what [] means in a path ?



Hi,

I have already used the debug. My input message is like this:

<Customer>
<CustomerID>1</CustomerID>
<CustomerName>
<Salutation>Mr.</Salutation>
<Name Location="First">John</Name>
<Name Location="Last">Doe</Name>
<FullName>John Doe</FullName>
</CustomerName>
</Customer>


Observed a strange thing:

The reference C that is created after executing the SELECT does not have the attributes as in the InputRoot.

C
Salutation:CHARACTER:Mr.
Name:CHARACTER:John
Name:CHARACTER:Doe
FullName:CHARACTER:John Doe

Customer
CustomerID:CHARACTER:1
CustomerName
Salutation:CHARACTER:Mr.
Name:CHARACTER:John
Location:CHARACTER:First
Name:CHARACTER:Doe
Location:CHARACTER:Last
FullName:CHARACTER:John Doe


you have not used the user trace, and not taken any notice of the hint
Hint: do you know what [] means in a path ?
Back to top
View user's profile Send private message
ganesh
PostPosted: Wed Aug 05, 2015 3:19 pm    Post subject: Re: How to select a value based on the attribute value Reply with quote

Master

Joined: 18 Jul 2010
Posts: 294

Sourya wrote:

Hi,

Tried this but did not work.

SET cln = SELECT ITEM C.Name FROM InputRoot.XMLNSC.Customer.CustomerName as C WHERE C.Name.(XMLNSC.Attribute)Location = 'Last';



Try this...

THE(SELECT ITEM S FROM ..............Name[] AS S WHERE S.(XMLNSC.Attribute)Location = 'Last');
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 » How to select a value based on the attribute value
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.