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 » Need help regarding Attribute value using esql

Post new topic  Reply to topic
 Need help regarding Attribute value using esql « View previous topic :: View next topic » 
Author Message
anilmekala
PostPosted: Fri Apr 17, 2015 12:45 am    Post subject: Need help regarding Attribute value using esql Reply with quote

Acolyte

Joined: 19 Oct 2012
Posts: 63

Hi ,

I hope every body doing good.

I have sample xml as below

<DATASTREAM.SEGMENTS index="1">19000160</DATASTREAM.SEGMENTS>
<DATASTREAM.SEGMENTS index="2">-1</DATASTREAM.SEGMENTS>
<DATASTREAM.SEGMENTS index="3"/>
<DATASTREAM.SEGMENTS index="4">I</DATASTREAM.SEGMENTS>

I want read DATASTREAM_SEGMENTS which index=1 through esql.

Please help me how to read that element.

Thanks in advance.

Regards,

Anil.
Back to top
View user's profile Send private message
christopher j
PostPosted: Fri Apr 17, 2015 1:30 am    Post subject: Reply with quote

Novice

Joined: 01 Jan 2010
Posts: 20

Have you tried ESQL select statement?
Back to top
View user's profile Send private message
anilmekala
PostPosted: Fri Apr 17, 2015 1:51 am    Post subject: Reply with quote

Acolyte

Joined: 19 Oct 2012
Posts: 63

Hi ,

thanks . I got solution with select statement.

Regards,

Anil.
Back to top
View user's profile Send private message
wmbfrz
PostPosted: Thu Jun 30, 2016 5:32 pm    Post subject: Reply with quote

Apprentice

Joined: 08 Jan 2010
Posts: 28

What is the solution?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Jun 30, 2016 10:11 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

wmbfrz wrote:
What is the solution?


What have you tried and what were the results?
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
wmbfrz
PostPosted: Fri Jul 01, 2016 12:55 am    Post subject: Reply with quote

Apprentice

Joined: 08 Jan 2010
Posts: 28

This is a sample message
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Sample>
<Total TotalType="TransactionGrandAmount">174.24</Total>
<Total TotalType="TransactionGrossAmount">174.24</Total>
<Total TotalType="TransactionNetAmount">174.24</Total>
<Total TotalType="TransactionTaxAmount">0</Total>
</Sample>

These are what i have tried.
SET tmp1 = THE ( SELECT ITEM C.Total FROM InputRoot.XMLNSC.Sample.Total.Item[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp2 = THE ( SELECT ITEM C.Total FROM InputRoot.XMLNSC.Sample.Total[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp1 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample.Total.Item[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp2 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample.Total[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');

None of the above works.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jul 01, 2016 4:54 am    Post subject: Reply with quote

Grand High Poobah

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

wmbfrz wrote:
This is a sample message
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Sample>
<Total TotalType="TransactionGrandAmount">174.24</Total>
<Total TotalType="TransactionGrossAmount">174.24</Total>
<Total TotalType="TransactionNetAmount">174.24</Total>
<Total TotalType="TransactionTaxAmount">0</Total>
</Sample>

These are what i have tried.
SET tmp1 = THE ( SELECT ITEM C.Total FROM InputRoot.XMLNSC.Sample.Total.Item[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp2 = THE ( SELECT ITEM C.Total FROM InputRoot.XMLNSC.Sample.Total[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp1 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample.Total.Item[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp2 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample.Total[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');

None of the above works.


try
Code:
SET tmp2 = THE ( SELECT C.Total VALUE FROM InputRoot.XMLNSC.Sample[] AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
-- or
SET tmp2 = THE ( SELECT FIELDVALUE(C.Total) FROM InputRoot.XMLNSC.Sample[] AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
wmbfrz
PostPosted: Fri Jul 01, 2016 5:10 am    Post subject: Reply with quote

Apprentice

Joined: 08 Jan 2010
Posts: 28

No.. that doesnt works either.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jul 01, 2016 5:13 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

wmbfrz wrote:
No.. that doesnt works either.


Doesn't work how?

It crashes the EG? It makes your desk turn green? It uninstalls your screensaver?

Or it gives an error message... ?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
wmbfrz
PostPosted: Mon Jul 04, 2016 1:11 am    Post subject: Reply with quote

Apprentice

Joined: 08 Jan 2010
Posts: 28

mqjeff wrote:
wmbfrz wrote:
No.. that doesnt works either.


Doesn't work how?

It crashes the EG? It makes your desk turn green? It uninstalls your screensaver?

Or it gives an error message... ?


I am wondering why you missed 'Alien Resurgence'! Jokes apart, the statements simply do not result in any value assigned to tmp and simply pass.
Back to top
View user's profile Send private message
maurito
PostPosted: Mon Jul 04, 2016 1:40 am    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

wmbfrz wrote:
mqjeff wrote:
wmbfrz wrote:
No.. that doesnt works either.


Doesn't work how?

It crashes the EG? It makes your desk turn green? It uninstalls your screensaver?

Or it gives an error message... ?


I am wondering why you missed 'Alien Resurgence'! Jokes apart, the statements simply do not result in any value assigned to tmp and simply pass.


If you run with a user trace it will soon become clear that your select is wrong.
for example
Code:
SET tmp2 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample.Total[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');


the dynamic reference C is pointing to InputRoot.XMLNSC.Sample.Total
therefore, if you
Code:
select C.Total
You are trying to get a value from
Code:

InputRoot.XMLNSC.Sample.Total.Total
Back to top
View user's profile Send private message
wmbfrz
PostPosted: Mon Jul 04, 2016 10:26 pm    Post subject: Reply with quote

Apprentice

Joined: 08 Jan 2010
Posts: 28

maurito wrote:
wmbfrz wrote:
mqjeff wrote:
wmbfrz wrote:
No.. that doesnt works either.


Doesn't work how?

It crashes the EG? It makes your desk turn green? It uninstalls your screensaver?

Or it gives an error message... ?


I am wondering why you missed 'Alien Resurgence'! Jokes apart, the statements simply do not result in any value assigned to tmp and simply pass.


If you run with a user trace it will soon become clear that your select is wrong.
for example
Code:
SET tmp2 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample.Total[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');


the dynamic reference C is pointing to InputRoot.XMLNSC.Sample.Total
therefore, if you
Code:
select C.Total
You are trying to get a value from
Code:

InputRoot.XMLNSC.Sample.Total.Total


Thanks for your reply. I tried the following based on your suggestion but got nothing in output.

SET tmp1 = THE ( SELECT ITEM C.Total FROM InputRoot.XMLNSC.Sample AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp2 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp1 = THE ( SELECT ITEM C.Total FROM InputRoot.XMLNSC.Sample[] AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp2 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample[] AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
--
Back to top
View user's profile Send private message
maurito
PostPosted: Mon Jul 04, 2016 10:30 pm    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

wmbfrz wrote:
SET tmp1 = THE ( SELECT ITEM C.Total FROM InputRoot.XMLNSC.Sample AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp2 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp1 = THE ( SELECT ITEM C.Total FROM InputRoot.XMLNSC.Sample[] AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
SET tmp2 = THE ( SELECT C.Total FROM InputRoot.XMLNSC.Sample[] AS C WHERE C.Total.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');
--

NO. Sample is not an array of elements. Total IS.
So you need to change whatever is after SELECT and not what is after FROM
Please run with a user trace as suggested and READ it and work out why you are getting nothing.
Back to top
View user's profile Send private message
wmbfrz
PostPosted: Tue Jul 05, 2016 5:01 am    Post subject: Reply with quote

Apprentice

Joined: 08 Jan 2010
Posts: 28

Thanks. Got this working
SET tmp3 = THE ( SELECT ITEM C FROM InputRoot.XMLNSC.Sample.Total[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');

But i noticed that it took me 4 stepovers to move from this statement instead of 3 regardless of using the ITEM keyword. I also tried to change the input message to have two items satisfying the condition but it alway took the third element's value but in 4 iterations. Can somebody please explain?
Back to top
View user's profile Send private message
maurito
PostPosted: Tue Jul 05, 2016 5:06 am    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

wmbfrz wrote:
Thanks. Got this working
SET tmp3 = THE ( SELECT ITEM C FROM InputRoot.XMLNSC.Sample.Total[] AS C WHERE C.(XMLNSC.Attribute)TotalType = 'TransactionNetAmount');

But i noticed that it took me 4 stepovers to move from this statement instead of 3 regardless of using the ITEM keyword. I also tried to change the input message to have two items satisfying the condition but it alway took the third element's value but in 4 iterations. Can somebody please explain?

I don't know what you are trying to say with the number of iterations or stepovers, but you will get only ONE value because you are specifying THE and ITEM. Please refer to the SELECT statement for clarification.
And once again, if you are worried about number of iterations/stepovers, gather a user trace and you will see what is happening.
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 » Need help regarding Attribute value using 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.