[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: "Alexander, Steve" <Steven.Alexander@sanjoseca.gov>
- Date: Thu, 29 Jan 2004 10:04:37 -0800
- List-id: This list is for discussion about the SQR database reporting language from Hyperion. <sqr-users.sqrug.org>
Use an array of totals and pass through your array once, adding each #nbr
into the appropriate element of the totals array. If the #IDs are all
integers and you know their range, the #ID can be the index of the totals
array. Otherwise, use load-lookup to map the #IDs into a consecutive
sequence of row numbers, which could then be the index of the totals array.
-----Original Message-----
From: Darrel Scott [mailto:darrel_1977@yahoo.com]
Sent: Thursday, January 29, 2004 9:46 AM
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