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 » Sorting Function in ESQL

Post new topic  Reply to topic
 Sorting Function in ESQL « View previous topic :: View next topic » 
Author Message
sarathmattam
PostPosted: Tue Oct 07, 2008 11:09 pm    Post subject: Sorting Function in ESQL Reply with quote

Voyager

Joined: 05 Sep 2008
Posts: 94

Hi All,

My requirement is as given below

I have an array with 10 date values. I need to get the latest one out of it with out comparing individual dates.

Is there any FUNCTION in ESQL which will sort the date or Integers??

Pls reply ASAP.. Thanks a lot in Advance..

Regards,
Sarath
Back to top
View user's profile Send private message
broker_new
PostPosted: Fri Oct 10, 2008 6:31 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

There is no FUNCTION to perform that.
We have done research on that and found QUICK sort algorithm is the efficient one
Back to top
View user's profile Send private message
tomshen
PostPosted: Tue Nov 04, 2008 11:01 pm    Post subject: so, How to write code of QUICKSORT algotithm in ESQL? Reply with quote

Newbie

Joined: 04 Nov 2008
Posts: 1

Please do me a favor. Thank you.
Back to top
View user's profile Send private message
Esa
PostPosted: Wed Nov 05, 2008 8:08 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

If you need to sort something in the message, just write a java class with a static method that uses java collections for sorting and wrap it with an ESQL LANGUAGE JAVA wrapper and you can call it from your ESQL code.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Tue Mar 30, 2010 11:48 pm    Post subject: QuickSort in ESQL Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Hello,

you might want to try and use quickSort(), which is capable of handling CHAR, INT and TIMESTAMP.
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
rsaavedra
PostPosted: Mon Jun 23, 2014 12:20 pm    Post subject: Order Qicksort Reply with quote

Newbie

Joined: 23 Jun 2014
Posts: 4

How I can use QuickSort in order with more than one criterion? and the "element" is not a property but a value of a tag.

thanks-
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Tue Jun 24, 2014 1:11 pm    Post subject: Re: Order Qicksort Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

I tried to describe it here, anyway... we can discuss it in more detail:

1. Sort on one criteria, then sort again on the second

2. "Pre-process" the (message-)tree and create another element myRef.tmp = "criteria1__criteria2" (also for more criterias). "Post-process" when you are done (and remove the temporary criteria): myRef.tmp=NULL (requires you to loop over the list before & after)

3. Post your data and what you want to do (here on mqseries.net)

4. I am a contractor and available

Quote:
and the "element" is not a property but a value of a tag.


Broker uses the most simple and beautiful structure internally: The "logical message tree". Everything should be "element=value" (and metadata attached to it)

A value of a tag should be "tag=value"... anyway e.g. pre- and post-process (if you require a certain (different) structure temporarily).
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
rsaavedra
PostPosted: Wed Jun 25, 2014 8:11 am    Post subject: Example XML ordered two criteria Reply with quote

Newbie

Joined: 23 Jun 2014
Posts: 4

Unordered XML
<message>
<header date="2010-03-17" time="16:02.123"/>
<list>
<element>
<criteria1>D</criteria1>
<criteria2>ABC</criteria2>
<criteria3>BC</criteria3>
<criteria4>A</criteria4>
<element>
<element>
<criteria1>A</criteria1>
<criteria2>ABC</criteria2>
<criteria3>C</criteria3>
<criteria4>A</criteria4>
<element>
<element>
<criteria1>F</criteria1>
<criteria2>ABC</criteria2>
<criteria3>BC</criteria3>
<criteria4>A</criteria4>
<element>
<element>
<criteria1>A</criteria1>
<criteria2>ABC</criteria2>
<criteria3>B</criteria3>
<criteria4>A</criteria4>
<element>
<element>
<criteria1>B</criteria1>
<criteria2>ABC</criteria2>
<criteria3>BC</criteria3>
<criteria4>A</criteria4>
<element>
<element>
<criteria1>A</criteria1>
<criteria2>ABC</criteria2>
<criteria3>A</criteria3>
<criteria4>A</criteria4>
<element>
</list>
</message>

XML Sorted by two criteria, criteria1 and criteria3

<message>
<header date="2010-03-17" time="16:02.123"/>
<list>
<element>
<criteria1>A</criteria1>
<criteria2>ABC</criteria2>
<criteria3>A</criteria3>
<criteria4>A</criteria4>
<element>
<element>
<criteria1>A</criteria1>
<criteria2>ABC</criteria2>
<criteria3>B</criteria3>
<criteria4>A</criteria4>
<element>
<element>
<criteria1>A</criteria1>
<criteria2>ABC</criteria2>
<criteria3>C</criteria3>
<criteria4>A</criteria4>
<element>
<element>
<criteria1>B</criteria1>
<criteria2>ABC</criteria2>
<criteria3>BC</criteria3>
<criteria4>A</criteria4>
<element>

<element>
<criteria1>D</criteria1>
<criteria2>ABC</criteria2>
<criteria3>BC</criteria3>
<criteria4>A</criteria4>
<element>
<element>
<criteria1>F</criteria1>
<criteria2>ABC</criteria2>
<criteria3>BC</criteria3>
<criteria4>A</criteria4>
<element>
</list>
</message>

thanks
[/code]
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Wed Jun 25, 2014 8:26 am    Post subject: Re: Example XML ordered two criteria Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Quicksort is stable

So when you sort(criteria3) and then sort(criteria1) it should have your desired outcome

That is option one ("1.")

... last criteria first... then move backwards
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
rsaavedra
PostPosted: Wed Jun 25, 2014 8:38 am    Post subject: Example XML ordered two criteria Reply with quote

Newbie

Joined: 23 Jun 2014
Posts: 4

Then I must first sort the xml for the last criterion and so on until the first.

So if I have 3 criteria, I run three times a QuickSort?

Thank you
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Jun 25, 2014 8:46 am    Post subject: Re: Example XML ordered two criteria Reply with quote

Jedi Council

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

rsaavedra wrote:
Then I must first sort the xml for the last criterion and so on until the first.

So if I have 3 criteria, I run three times a QuickSort?

Thank you


Why don't you try it for yourself and see? You may well learn more about it that way.
_________________
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
rsaavedra
PostPosted: Wed Jun 25, 2014 8:51 am    Post subject: Re: Example XML ordered two criteria Reply with quote

Newbie

Joined: 23 Jun 2014
Posts: 4

smdavies99 wrote:
rsaavedra wrote:
Then I must first sort the xml for the last criterion and so on until the first.

So if I have 3 criteria, I run three times a QuickSort?

Thank you


Why don't you try it for yourself and see? You may well learn more about it that way.


I will do tests and let me tell you.

thanks
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 » Sorting Function in 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.