|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Sort and Rules Issue |
« View previous topic :: View next topic » |
Author |
Message
|
EvolutionQuest |
Posted: Mon Dec 20, 2004 6:51 am Post subject: Sort and Rules Issue |
|
|
 Voyager
Joined: 18 Sep 2001 Posts: 88 Location: Billings, MT
|
I have a situation that I am having difficulty in resolving through WMQI v2.1.
I have two criterias that I am trying to fulfill that I am not sure how to accomplish smoothly in Integrator.
TAG|INT_VALUE1|INT_VALUE2
SAM|4|100
SAM|1|75
SAM|2|100
SAM|3|100
or
SAM|4|100
SAM|1|100
SAM|2|100
SAM|3|100
or
SAM|4|100
SAM|1|75
SAM|2|100
SAM|3|75
or
SAM|4|75
SAM|1|75
SAM|2|75
SAM|3|100
1. If I have a compound type tag delimited with two integer fields, which the tag can repeat up to 4 max times I must place INT_VALUE2 in decending order (bubble sort maybe). If there are two repeating values in INT_VALUE2 I then need to get the lowest INT_VALUE1 for INT_VALUE2 (bubble sort maybe).
The first swipe would be simple since I would be sorting INT_VALUE2 in numeric order. Then the assumption would be I need to loop through and check for repeating INT_VALUE2 in the top two. If there are then I will need to determine the low values.
So, does this make sense. I was taking a more complicated process of doing a psuedo two-dimensional sort, but I am think this is a little bit of a stretch.
Just would like some confirmation or other suggestions. The key is to get the highest value of INT_VALUE2, and hopefully not have more than one. The sticking point I am enduring is if 3 or more INT_VALUE2 repeat. Then I suspect I will need to run another sort. Is there a more effient way as I suspect there will be at least 4 loops.
Your wisdom is greatly appreciated. |
|
Back to top |
|
 |
EvolutionQuest |
Posted: Mon Dec 20, 2004 8:00 am Post subject: |
|
|
 Voyager
Joined: 18 Sep 2001 Posts: 88 Location: Billings, MT
|
Well, I was forced to use a stored procedure although that was not the original desire from the team.
If I had the capability of ORDER BY I could of done this in WMQI.
I just had to do the following:
Code: |
DECLARE CURSOR_CHRIS CURSOR WITH RETURN FOR
SELECT x.VALUE1, x.VALUE2
FROM (
SELECT II_VALUE_1 VALUE1, ID_VALUE_1 VALUE2
FROM SYSIBM.SYSDUMMY1
UNION
SELECT II_VALUE_2 VALUE1, ID_VALUE_2 VALUE2
FROM SYSIBM.SYSDUMMY1
UNION
SELECT II_VALUE_3 VALUE1, ID_VALUE_3 VALUE2
FROM SYSIBM.SYSDUMMY1
UNION
SELECT II_VALUE_4 VALUE1, ID_VALUE_4 VALUE2
FROM SYSIBM.SYSDUMMY1)x
GROUP BY x.VALUE1, x.VALUE2
ORDER BY x.VALUE2 DESC, x.VALUE1 ASC; |
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|