[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] fetch value in array
- Subject: RE: [sqr-users] fetch value in array
- From: "the dragon" <ceprn@hotmail.com>
- Date: Fri, 06 Jan 2006 13:35:28 -0600
- Bcc:
- Delivery-date: Fri, 06 Jan 2006 14:37:32 -0500
- In-reply-to: <20060106180755.1682.qmail@web52013.mail.yahoo.com>
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
First you'll need to sort the array to make certain it's in order; you may
need to build a key for this..
Then you'll need to parse through the table and find the maximum values for
any record, and then do whatever that needs to happen to that record.
Or, you could create a temp table, insert the flat file records into that
temp table and then select the values out that you need. This is a lot
cleaner, faster and will allow you to use the database for the processing.
You're a programmer, so I'll let you build the actual code.
peace,
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.
I work to live; I don't live to work.
"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----
Thanks for the reply..
I'm getting data from flat file not from table. Thats
the reason I'm using array. What I'm doing is reading
data from flat file, validating emplid in ps_job
record, if emplid doesn't exist in job record, emplid
and max count should show on report.
Thanks,
Prashanth
--- Bob Stone <bstone@fastenal.com> wrote:
> wow. convoluted example....nice use of the same 3
> letters all caps for
> 5 different employees...real readable.
>
> So, I'm going to pretend the first guy is ABC,
> second is LMN, and third
> is XYZ. Or maybe we got Jones, Smith, and Grady.
> ...XYZ ZYX YZX YXZ,
> not so good.
>
> select *
> from YOURTABLE a
> where (a.emplid, a.company, a.count) in
> (select b.emplid, b.company, b.count from
> yourtable b
> where a.emplid = b.emplid and a.company =
> b.company
> and b.count = ( select max(c.count) from
> YOURTABLE c where
>
> b.emplid = c.emplid and
> b.company = c.company)
>
> Is there an easier way? probably. do you have to
> join 3 times? maybe
> not. It's just what I would try.
>
>
> -----Original Message-----
>
> Hi,
>
> I'm using array in sqr and data in array looks like
> this:
>
> Emplid Company Count
> XYZ A 1
> XYZ A 2
> XYZ A 3
> YXZ B 1
> YXZ B 2
> YXZ B 3
> ZYX A 1
> YZX B 1
>
> >From this array I'm supposed to get max count for
> each
> emplid, i.e for emplid XYZ have to get line 3 (XYZ
> A
> 3), for emplid YXZ (YXZ B 3) and for emplid ZYX
> (ZYX
> A 1).
>
> When i compare row value, I'm not able to get the
> correct results.
> Any help or suggestion would be appreciated.
>
> Thanks,
> Prashanth
>
>
_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users