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 » Selecting a MAX value

Post new topic  Reply to topic
 Selecting a MAX value « View previous topic :: View next topic » 
Author Message
gabbar
PostPosted: Wed Feb 04, 2004 8:02 am    Post subject: Selecting a MAX value Reply with quote

Acolyte

Joined: 10 Dec 2002
Posts: 50

Can anyone suggest the simplest ESQL expression of selecting a MAX value from a repeating group of elements.

In my XML, i have an element which may occur more than once in the same message, as in the following example:

<TESTXML>
<TESTGRP>
<MYVALUE>20</MYVALUE>
</TESTGRP>
<TESTGRP>
<MYVALUE>30</MYVALUE>
</TESTGRP>
</TESTXML>

I am supposed to select the max(MYVALUE) from the incoming XML. I hope the SELECT with MAX call will help do this.

Can anyone help?

Thanks
Back to top
View user's profile Send private message Visit poster's website
kirani
PostPosted: Wed Feb 04, 2004 10:38 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Try this,

Code:

SET Environment.Variables.MYMAXVALUE = THE (SELECT ITEM MAX(t.MYVALUE) from InputRoot.XML.TESTXML.TESTGRP[] as t)

_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
gabbar
PostPosted: Wed Feb 04, 2004 10:57 am    Post subject: Reply with quote

Acolyte

Joined: 10 Dec 2002
Posts: 50

I am on wmqi 2.1 csd03. Does MAX work for me? Compute Node doesn't like the Syntax.

Quote:
SET Environment.Variables.MYMAXVALUE = THE (SELECT ITEM MAX(t.MYVALUE) from InputRoot.XML.TESTXML.TESTGRP[] as t);
Back to top
View user's profile Send private message Visit poster's website
kirani
PostPosted: Wed Feb 04, 2004 11:17 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Are you getting a Deploy Error or it's just a syntax error in the Control center? If it's a syntax error, then ignore it and try doing a deploy.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
gabbar
PostPosted: Wed Feb 04, 2004 11:26 am    Post subject: Reply with quote

Acolyte

Joined: 10 Dec 2002
Posts: 50

Like you said I deployed despite the syntax error. This is what I see when I deploy.

Quote:
BIP2938E: An attempt was made to execute the non existent function or procedure 'MAX'.
Back to top
View user's profile Send private message Visit poster's website
kirani
PostPosted: Wed Feb 04, 2004 12:06 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

I tried this code on my machine and it's working correctly. I am at CSD4, but I don't think its an issue, MAX column function is supported by ESQL.
Code:

SET Environment.Variables.MYMAXVALUE = THE (SELECT MAX(t.MYVALUE) from InputRoot.XML.TESTXML.TESTGRP[] as t);


As you can see in my code, I removed ITEM clause.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
gabbar
PostPosted: Wed Feb 04, 2004 12:23 pm    Post subject: Reply with quote

Acolyte

Joined: 10 Dec 2002
Posts: 50

Strange as it is, removing the ITEM keyword makes the broker now recognize the MAX function.

It works!!

Thanks Kiran
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Selecting a MAX 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.