[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] Array Sort/Grouping Help
- Subject: RE: [sqr-users] Array Sort/Grouping Help
- From: "Patel, Samir" <SPatel@fdic.gov>
- Date: Thu, 29 Jan 2004 13:03:41 -0500
- List-id: This list is for discussion about the SQR database reporting language from Hyperion. <sqr-users.sqrug.org>
Darrel, I did not read the entire thread, so I don't have a full
understanding of what you are trying to do, but you may want to try
something like this:
1) Do your select
2) For each row, check if it exists in array
3) If so,then add #nbr, else, put in array
4) Do for all rows, thus your array will now everything summed up
5) After the select is done, get from array and print
Hope that helps,
Samir
-----Original Message-----
From: Darrel Scott [mailto:darrel_1977@yahoo.com]
Sent: Thursday, January 29, 2004 12:46 PM
To: sqr-users@sqrug.org
Subject: Re: [sqr-users] Array Sort/Grouping Help
George -
I'm not sure if your solutions will help. Let me apologize in advance if
they do, but I can't see it.
My array already passes in the values I need. My problem is due to the way
the data is set up, I will obtain multiple IDs with my initially "summed up"
NBRs. I've tried every possible way I can think of to re-write my SQL to
give me the results I need, but to no avail.
So for every #ID in my array, I need to add the values from their
cooresponding #NBRs together. That new value (#NBR_SUM) along with the #ID
will be then printed to an output file.
In other words, rather than printing:
*********************
#ID: 001
#NBR: 123456
#ID: 002
#NBR: 987456
#ID: 003
#NBR: 555444
#ID: 001
#NBR: 000111
*********************
....I need to see:
*********************
#ID: 001
#NBR_SUM: 123567 <--- NEW VALUE
#ID: 002
#NBR_SUM: 987456
#ID: 003
#NBR_SUM: 555444
*********************
I'm in the process of putting together a "bubble sort" as "The Dragon"
suggested. But I'm always open to other possibilities.
Thanks,
Darrel
George Jansen <GJANSEN@aflcio.org> wrote:
So you have
K1 -> S1 -> ID1, ID2 ...
S2 -> ID1, ID2
K2 -> S1 -> ID1, ID2 ...
S3 -> ID4, ID5...
...
Is it possible that you are approaching this the wrong way around?
Perhaps instead of build the IN lists you need a three-way join, and a
series of ON-BREAK procedures. This would allow you to
Failing that, what if you did a load lookup?
1. Create a view of the unique IDs--in Oracle terms this might be
CREATE OR REPLACE VIEW unique_b_ids
AS
SELECT id, rownum as rn
FROM (SELECT id from b order by id);
2. Code your load-lookup
load-lookup
name=b_ids
rows=????
table=unique_b_ids
key=id
return_value=rn
3. Then you can find out where in the array to stash your value (or add
it)
with
lookup b_ids #id #idx
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users