[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 08:37:00 -0800
- List-id: This list is for discussion about the SQR database reporting language from Hyperion. <sqr-users.sqrug.org>
Are you trying to get the total for just one value of ID, or the totals for
each value?
-----Original Message-----
From: the dragon [mailto:ceprn@hotmail.com]
Sent: Thursday, January 29, 2004 7:18 AM
To: sqr-users@sqrug.org
Subject: Re: [sqr-users] Array Sort/Grouping Help
sure - you can use a sort on the array. My favorite is a bubble sort.
then, once the array is sorted, you can process it.
clark 'the dragon' willis
PSA: Salary <> Slavery. If you earn a salary, your employer is renting your
services for 40 hours a week, not purchasing your soul. Your time is the
only real finite asset that you have, and once used it can never be
recovered, so don't waste it by giving it away.
"Time is the coin of your life. It is the only coin you have, and only you
can determine how it will be spent. Be careful lest you let other people
spend it for you."
Carl Sandburg
(1878 - 1967)
----Original Message Follows----
George -
First of all let me apologize for the title of this email. I didn't mean for
it to be so vague. I've changed it accordingly.
Secondly, If it was that simple, I wouldn't have posted to this forum :)
What's funny is that I'm already using a GROUP BY expression in my data
source before passing the values in to the array. See below...
-------------------------------------
Begin-Procedure Get-IDs
Begin-Select
a.ID &ID
Move &ID to $ID
Move &ID to #ID
SUM(b.nbr) &NBR
Move &NBR to $NBR
Move &NBR to #NBR
Let #i=0
Do Build-Array
Do Load-Array
FROM TABLE a, TABLE2 b
WHERE a.key = &Key !-- Passed from earlier procedure
AND a.seqnbr IN [$SEQNBR_list] !-- Passed from earlier procedure
AND a.ID = b.ID
group by a.ID
End-Select
End-Procedure
-------------------------------------
Here's the detailed gist...in a nutshell, I grab the KEY from an earlier
query. Using that key I get a list of SEQNBRs. I concatenate those SEQNBRs
and pass them into a list that I inturn use to get the specific IDs that I
need. The problem is that I can get multiple IDs for each KEY. So why can't
I use GROUP-BY logic on the key? Simple - the KEY is unique and will never
be the same. Thus grouping on both the key and ID prevents an accurate list
throwing off the entire SQR.
That's what brings me to this point. Is there a way to get my results from
within my array?
Thanks,
Darrel
George Jansen <GJANSEN@aflcio.org> wrote:
What is your data source? If a relational database, why not write your
SELECT as
SELECT id, sum(nbr) as nbr
FROM whatever
GROUP BY id
>>> darrel_1977@yahoo.com 01/29/04 08:51AM >>>
Hello Fellow SQR'ers...
I'm wondering if anyone out there can assist me.
I'm working with an array with two numeric values (#ID & #NBR) in which
when loaded into the array can look like the output below...
*********************
#ID: 001
#NBR: 123456
#ID: 002
#NBR: 987456
#ID: 003
#NBR: 555444
#ID: 001
#NBR: 000111
*********************
As you can see I have two instances of the #ID variable (which is
expected). Is it possible to sum the #NBR variable for both (or however
many) instances of the #ID and pass that total into a new variable? I
guess I'm looking for a FOR-EACH type of a loop or some type of array
sort, but I've been unable to find any documentation to assist in this
situation.
BTW....my load array logic is below...
---------------------------------------------------
Begin-Procedure Load-Array
Let #Ctr=0
While #Ctr <= #i - 1
If #Ctr > #i - 1
break
End-If
Get #ID #NBR
>From DataArray(#Ctr)
Add 1 to #Ctr
#Debug Show 'ID: '#ID !-- TEST
#Debug Show 'NBR: '#NBR !-- TEST
End-While
Let #ID=0
Let #NBR=0
End-Procedure
---------------------------------------------------
Any assistance would be greatly appreciated.
Thanks,
Darrel
---------------------------------
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
---------------------------------
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
_________________________________________________________________
There are now three new levels of MSN Hotmail Extra Storage! Learn more.
http://join.msn.com/?pgmarket=en-us&page=hotmail/es2&ST=1
_______________________________________________
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