How to get the latest row from my Logical Table Source?
Hi everyone,
I have a SALARY_HISTORY table that holds the Salary Date and the Salary Amount for an employee, as a simple example. In my Business Model, I want to have a Display Folder called "Current Salary" and use the Where Clause restriction to derive the latest salary for each of my employees.
In standard SQL Plus, I used a nested SQL statement, e.g. "where a.SalaryDate = (select max(b.SalaryDate) from SALARY_HISTORY b where b.employeeid = a.employeeid)".
Is there anyway in the "Where Clause" filter of the LTS to derive this type of a query?
I have tried things like "DB".""."SCHEMA"."AL_SALARY_HISTORY"."SalaryDate" = EVALUATE('SELECT_PHYSICAL MAX(SALARY_DATE) FROM "DB".."SCHEMA"."AL_SALARY_HISTORY" WHERE employeeid = %1)', "DB".""."SCHEMA"."AL_SALARY_HISTORY"."employeeid"). And I know I can't use any of the analytic functions in a where clause.
So how do I go about this other than creating a View in the database or creating a function in the database to give me the maximum salary date for my employee?
Thanks
Paul
Hi Paul,
You could achieve this requirement using a sub query. Briefly, the steps are
1. Just create one report with max(salary_date) for each employee.
2. Create another report with SALARY_DATE included.
3. Create a filter (Based on another analysis) on this report, as employee is in(Employee of report in step1) AND SALARY_DATE IS IN(SALARY_DATE of report in step1)(this is the max_salary_date for him)
You could notice that BI Server would send two queries to the backend for this info.
Hope this helps.
Thank you,
Dhar
Similar Messages
-
Master Child tables how to get the latest rows from both
Hi,
Need some help with the sql. I have two tables Master & Child. In my Master table I have multiple rows for the same record and in the child table also multiple rows for the same master row how can I get the latest one's from both.
For example Data in my Master table looks like
CONT_ID SEQ_NUM DESCRIPTION
1 189 Update 2
1 188 Update 1
1 187 NewNow in the child table for the same CONT_ID I may have the following rows
CONT_ID UPDATED_DATE STATUS
1 3/16/2010 2:19:01.552700 PM P
1 3/16/2010 12:29:01.552700 PM A
1 3/16/2010 12:29:01.552700 PM P
1 3/16/2010 12:19:01.552700 PM NIn my final query how can I get the row with seq_num 189 as it's the latest in Master table and from child table the row with status of P as it's the latest one based on the time. Here is the query i have but it returns the latest row from the child table only and basically repeats the master table rows as opposed to one row that is latest from both:
ThanksHi,
You can use the analytic ROW_NUMKBER function to find the latest row for each cont_id in each table:
WITH got_m_rnum AS
SELECT cont_id, seq_num, description
, ROW_NUMBER () OVER ( PARTITION BY cont_id
ORDER BY seq_num DESC
) AS m_rnum
FROM master_table
-- WHERE ... -- any filtering goes here
, got_c_rnum AS
SELECT cont_id, updated_date, status
, ROW_NUMBER () OVER ( PARTITION BY cont_id
ORDER BY updated_date DESC
) AS c_rnum
FROM child_table
-- WHERE ... -- any filtering goes here
SELECT m.cont_id, m.seq_num, m.description
, c.updated_date, c.status
FROM got_m_rnum m
JOIN got_c_rnum c ON m.cont_id = c.cont_id
AND m.m_rnum = c.c_rnum
AND m.m_rnum = 1
;If you'd like to post CREATE TABLE and INSERT statements for the sample data, then I could test this.
If there happens to be a tie for the latest row (say, there are only two rows in the child_table with a certain cont_id, and both have exactly the same updated_date), then this query will arbitrarily choose one of them as the latest. -
How to get the latest version from DTR
Hi all,
I have all the latest code in my system 1 and i checkined the activites.Now i want all that code in my system 2.
Now i used sync from sources to get the lateset code.
But i am not able to get all the files and the build is getting failed.
Can any one plz help me out
Regards
Padma NHi,
Inorder to get the lateset version from DTR i used the procedure given by you.But at the second time if i want to get the lateset version from DTR wat to do??I didnt find the option of create project again because i already have to project in my workspace.
wat to do inorder to get the lateset source code from DTR 2nd time???
Regards
Padma N -
How to get the last row of a database table.
HI ,
I want to get record exactly from the last row of a database table.
How is that possible?Hi,
To fetch last record from an internal table, just do find the number of records in it and read using index.
DESCRIBE TABLE ITAB LINES L_LINES.
READ TABLE ITAB INDEX L_LINES.
You can also use LOOP .. ENDLOOP but the above method is better (performance wise).
using LOOP .. ENDLOOP.
LOOP AT ITAB.
**do nothing
ENDLOOP.
**process ITAB (Header record of ITAB).
**after ENLOOP, ITAB will have the last record of the internal table.
[here ITAB is internal table as well as header record.]
But what is the requirement?
If you are looking for the current record of an employee then you can use ENDDA = HIGH_DATE.
My advice is to review your requirement again and try to fetch only that record which you need.
Mubeen -
Getting the Selected Row from a JTable
hi,
how Can i get the Selected row from a JTable
thanks...You know that JTable class? Well, you see those methods in it called "getSelectedRow()" and "getSelectedRows()"...?
-
How to get the return values from a web page
Hi all :
how to get the return values from a web page ? I mean how pass values betwen webflow and web page ?
thank you very much
Edited by: jingying Sony on Apr 15, 2010 6:15 AM
Edited by: jingying Sony on Apr 15, 2010 6:18 AMHi,
What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
Regards,
Karri -
How to get the latest credit limit values per each customer in the report.
Hi All,
Can anybody give me an idea on how to get the latest credit limit values per each customer in the report.
I have below requiremnt.
I have cube which is having transactional data on document and customer level .and it also having master data info object in the cube which is credit management view having all the customer numbers .
This credit management view is master data info object having credit limit key figure as attribute.These credit limit are per each customer.
So we need these credit limits in the report as dynamic values .(I mean whatever be the current credit limit in the master data table for that paricular customer that should show up in the reporting).
one more thing these credit limits should roll up correctly at the HTR level.
One HTR having number of customers .
for example HTR 100 can have customer number 200,300,400.
Those 200,300,400 customer credit limits should roolup correctly at the HTR 100 level.
Example below :
Cube DATA :
HTR Customer Doct number Credit managment view
100 200 10001 200
100 200 10002 200
100 300 10004 300
100 300 10005 300
100 400 10006 400
100 400 10007 400
100 400 10008 400
Master data tabel (P Table)(Credit managment view)
Credit managment view Credit limits
200 1000.00
300 50000.00
400 90000.00
Please remeber :
We can not make these credit limits as navigational becasue these are keyfigure attributes not characteristics.
one more thing we can not make them as charatistics because we need use these credit limits to derive other calkculation. so it is not possibel to derive calculations on charactristics .Create a formula variable of type replacement path with reference as attibutes of Credit management view and choose your key figure credit limit,say zcredit.
Now create a formula or CKF and use zcredit.
This should display the credit limit in your report as normal key figure.
I didnot get this part "one more thing these credit limits should roll up correctly at the HTR level.", may be the above will solve this too.Try it.
Hope this helps. -
How to get the latest creditlimits in the reporting
Hi All,
Can anybody give me an idea on how to get the latest credit limit values per each customer in the report.
I have below requiremnt.
I have cube which is having transactional data on document and customer level .and it also having master data info object in the cube which is credit management view having all the customer numbers .
This credit management view is master data info object having credit limit key figure as attribute.These credit limit are per each customer.
So we need these credit limits in the report as dynamic values .(I mean whatever be the current credit limit in the master data table for that paricular customer that should show up in the reporting).
one more thing these credit limits should roll up correctly at the HTR level.
One HTR having number of customers .
for example HTR 100 can have customer number 200,300,400.
Those 200,300,400 customer credit limits should roolup correctly at the HTR 100 level.
Example below :
Cube DATA :
HTR Customer Doct number Credit managment view
100 200 10001 200
100 200 10002 200
100 300 10004 300
100 300 10005 300
100 400 10006 400
100 400 10007 400
100 400 10008 400
Master data tabel (P Table)(Credit managment view)
Credit managment view Credit limits
200 1000.00
300 50000.00
400 90000.00
Please remeber :
We can not make these credit limits as navigational becasue these are keyfigure attributes not characteristics.
one more thing we can not make them as charatistics because we need use these credit limits to derive other calkculation. so it is not possibel to derive calculations on charactristics .
Edited by: sirisha Nekkanti on Oct 30, 2008 6:27 PM
Edited by: sirisha Nekkanti on Oct 30, 2008 6:35 PMThis is duplicate of
how to get the latest credit limit values per each customer in the report.
thread. -
How to get the current week from sysdate?
Hi sir,
i want to know how to get the current week from sysdate?
thanksHi Nicolas
It seems you like to check my post and also make commend ;) thanks for your attention
Have you ever read the posts above and given solutions ?Yes, I did
Have you read the docs ? Yes, I checked
What's the added value here ?Did youYou shared doc with solution(long one), I shared short one which point same solution(Check what Joel posted)..So what is benefit, As you can guess oracle docs are sometimes become so complicated as specialy for beginner...(At least it was like that for me and Belive me somedocs are still sooo complicated even for oracle coworkers ) But for you I dont know ;)
=> Why writting the PS in bold ?Why.. Let me think... Ohh Maybe I am looking some questions(many) and even user get answer they should not changed status so I am reading some posts and try to get problem and loosing time..
So I am putting that PS wiht BOLD because I dont wanna lose time my friend ;) Because While I am trying to help ppl here In same time I am trying to giving support to my customer prod systems. Which mean time is very important for me...
Hope my answer could satisfy you..
One important PS for you.. You may not like my posts (or someone) but my friend I become tired to read&answer and make commend to on your comment which is about my posts.
I am not newbie in forum(At least I fell like that) and I belive I know how I should make post..
Thank you
Regards
Helios -
How to get the selection parameters from logical database into one of the t
Hi Sap ABAP Champians,
How to get the selection parameters from logical database into one of the tab in the tabstrip selection-screen.
Please help me for this
Thanks
BasuHi
Thanks, that will work, but then I'll have to insert code into all my reports.
I can see that "Application Server Control Console" is able to rerun a report.
This must mean that the Report Server has access to the runtime parameters.
But how?
Cheers
Nils Peter -
How to get the date starting from 1 to the current date from the system dat
Dear all,
Please tell me how to get the date starting from 1 based on the system date
and it should come with respect of time also.
example.
suppose today is 6 Dec, 2006
so ABAP report should find the 1 dec. 2006.
Please help me as soon as possible.
Regards,concatenate sy-datum0(2) '01' sy-datum4(4) into v_firstdate.
or yo ucan use the fm:
HR_JP_MONTH_BEGIN_END_DATE
usage:
call function 'HR_JP_MONTH_BEGIN_END_DATE'
exporting
iv_date = sy-datum
importing
ev_month_begin_date = gv_begda
ev_month_end_date = gv_endda.
Regards,
Ravi
Message was edited by:
Ravi Kanth Talagana -
How to get the latest procured value of a spare updated in material master
How to get the latest procured value of a spare updated in material master
J S S PRASAD
See table MBEW via transaction SE16.
However, you may need to look at the last PO created for that material.
PeteA -
How to get the latest versions of Internet Explorer t
We are running Single Primary Site with SCCM 2012 R2.
I
cant seem to find out how to get the latest versions of Internet Explorer to be included in software updates? Do you have to download this separately and install manually?Like Henrik said, make sure you have the Classifications selected that you want to address. IE 11 is the current browser, that was added to the catalog a few months back. If you are searching for this month you wont find it.
-
How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way
Hi,
Thanks for the suggestion. I've been playing around with some of the classes of the java.net package and java.io
Using the URL class i can get the content of the data from a STATIC page and output that response to file so that is does not display to the client broswer.
But this only works if the URL i give points to a static html page.
So the problem i'm getting is if i'm righting in arguments in the URL, this means that server needs to process the arguments i give and its sends back a dynamic result. Because its dynamic the URL class can not handle this and throws me an exception everytime :(
Have u ever tried to do some things like this?
Rahul -
How to get the Database type from weblogic Db connection
I want to use database version control in my application . that means different database type use different Sql Statement. Such as in weblogic7.0 if I create SqlServer JDBC pool then I will use some special Sqlserver sql Statement . such as some join statement. If I create Oralce JDBC pool then I have to use different Sql statement . because these two database support different Sql statement.
What my question is how to get the database type from the connection.For a normal jdbc driver you can use
Connection.getMetaData()
To get the meta data, in particular the getDatabase...() methods.
That might or might not work.
However, at the very least in the server you have access to the weblogic properties so you can parse the pool property to figure it out.
Maybe you are looking for
-
How do I get the built-in microphone to work on my IMac? Camera works fine, but I can't record sound.
-
IMessage has randomly stopped working on my Macbook Pro, what can I do?
My iMessage on my macbook pro has stopped working. I can log in just fine and I have logged out and back in but still cannot send or receive messages. It worked just fine at my house and last year at college but for whatever reason it has stopped wor
-
HT1535 i have a ipod how but my apple id is not working/ bu my iphone is working.
i have a ipod everytime i go to apps it ask for apply id password i type my password and it doesnt work. on my ipod <Email Edited by Host>
-
B-Channel Aggregation on H.320
I have been trying for several days to get h.323 video calls across ISDN to another location. I have my h323 endpoint and gateway registered with the gatekeeper. I can make the video call from the endpoint, which hits the gateway successfully. I can
-
Can IPTC metadata be included in Shared Photo Streams?
I was surprised that my version name and all IPTC data such as my ratings, key words, etc. are not appearing in my Shared Photo Streams. Is there any way to include this metadata?