A better way to get current and previous status?
I'm working on a system where status messages are read into a table for items of equipment. My requirement is to find all the messages arriving within a particular time window, together with the status value and the status value for the previous message sent for that equipment item, if any. This previous message can (and probably will) have a date outside the window I'm looking at, or might not exist at all for a brand new equipment item.
The table looks something like this:
create table eq_state
(eq_id NUMBER, -- ID of the equipment
event_date DATE, -- Date/Time of the message
status NUMBER) -- Status passed in the messageThere are indexes on (event_date,eq_id) and on eq_id. It'll get very big, so it's important that indexes are used wherever possible.
Here's what I have so far:
WITH eq_state AS
SELECT 1 eq_id, TO_DATE('01/05/2013 12:01:00','DD/MM/YYYY HH:MI:SS') event_date, 1 status FROM DUAL
UNION ALL
SELECT 2 eq_id, TO_DATE('01/05/2013 01:01:00','DD/MM/YYYY HH:MI:SS') event_date, 2 status FROM DUAL
UNION ALL
SELECT 2 eq_id, TO_DATE('01/05/2013 12:02:00','DD/MM/YYYY HH:MI:SS') event_date, 3 status FROM DUAL
UNION ALL
SELECT 3 eq_id, TO_DATE('01/05/2013 10:00:00','DD/MM/YYYY HH:MI:SS') event_date, 4 status FROM DUAL
UNION ALL
SELECT 3 eq_id, TO_DATE('01/05/2013 12:03:00','DD/MM/YYYY HH:MI:SS') event_date, 5 status FROM DUAL
UNION ALL
SELECT 3 eq_id, TO_DATE('01/05/2013 12:04:00','DD/MM/YYYY HH:MI:SS') event_date, 6 status FROM DUAL
SELECT eq_id,TO_CHAR(event_date,'DD/MM/YYYY HH:MI:SS') event_date,curr_state,prev_state
FROM (SELECT Es.Eq_Id,
Es.Event_Date,
Es.Status AS Curr_State,
Es2.Status AS Prev_State,
RANK() OVER (PARTITION BY es.eq_id,es.event_date ORDER BY es2.event_date DESC) the_rank
FROM Eq_State Es
LEFT OUTER JOIN Eq_State Es2
ON Es2.Eq_Id = Es.Eq_Id
AND Es2.Event_Date < Es.Event_Date
WHERE Es.Event_Date BETWEEN TO_DATE('01/05/2013 12:00:00','DD/MM/YYYY HH:MI:SS')
AND TO_DATE('01/05/2013 12:05:00','DD/MM/YYYY HH:MI:SS')) x
WHERE the_rank = 1
ORDER BY 1,2This gives me the desired results and seems to use sensible indexes (I'll spare you the explain plan):
EQ_ID EVENT_DATE CURR_STATE PREV_STATE
1 01/05/2013 12:01:00 1
2 01/05/2013 12:02:00 3 2
3 01/05/2013 12:03:00 5 4
3 01/05/2013 12:04:00 6 5So what's the problem? Just curiosity really - the technique of finding the RANK() in the inline view, and then selecting rows where it's equal to 1 seems like a bit of a kludge. Is there a more elegant way to do it? Maybe something using LAG() or KEEP DENSE_RANK LAST?
I'm still not really up-to-speed with analytic functions, so I'm hoping to learn something from those of you that are!
ORACLE 11.2.0.1.0 by the way
I would use another way, firstly sorting by any unique criteria and using joins
WITH eq_state AS
SELECT 1 eq_id, TO_DATE('01/05/2013 12:01:00','DD/MM/YYYY HH:MI:SS') event_date, 1 status FROM DUAL
UNION ALL
SELECT 2 eq_id, TO_DATE('01/05/2013 01:01:00','DD/MM/YYYY HH:MI:SS') event_date, 2 status FROM DUAL
UNION ALL
SELECT 2 eq_id, TO_DATE('01/05/2013 12:02:00','DD/MM/YYYY HH:MI:SS') event_date, 3 status FROM DUAL
UNION ALL
SELECT 3 eq_id, TO_DATE('01/05/2013 10:00:00','DD/MM/YYYY HH:MI:SS') event_date, 4 status FROM DUAL
UNION ALL
SELECT 3 eq_id, TO_DATE('01/05/2013 12:03:00','DD/MM/YYYY HH:MI:SS') event_date, 5 status FROM DUAL
UNION ALL
SELECT 3 eq_id, TO_DATE('01/05/2013 12:04:00','DD/MM/YYYY HH:MI:SS') event_date, 6 status FROM DUAL
), sorted as (
select row_number() over (order by a.event_date) as rn, a.* from eq_state a
select * from sorted s1
left join sorted s2 on (s2.rn = s1.rn -1)
order by s1.rn
RN EQ_ID EVENT_DATE STATUS RN EQ_ID EVENT_DATE STATUS
1 2 01.05.2013 01:01:00 2
2 3 01.05.2013 10:00:00 4 1 2 01.05.2013 01:01:00 2
3 1 01.05.2013 12:01:00 1 2 3 01.05.2013 10:00:00 4
4 2 01.05.2013 12:02:00 3 3 1 01.05.2013 12:01:00 1
5 3 01.05.2013 12:03:00 5 4 2 01.05.2013 12:02:00 3
6 3 01.05.2013 12:04:00 6 5 3 01.05.2013 12:03:00 5
Similar Messages
-
Easier and better ways to solve current problems with Acrobat?
Is there no better and easier way to solve the problems (installation, re-installing and crashing) with Acrobat? I really think that the ball is in Acrobat's corner right now, because I should not (for example) need to deactivate and re-activate my subscription in order to get AcrobatPro XI to work on my computer, let alone deinstalling an older version that (for now) does work, risking that in the end neither of them work. I need the (great) AdobeCloud applications to do my work as a freelancer, and I really cannot afford this kind of trouble with my applications, nore loose time repairing them. These are difficult times as it is.
Regards,
MarcSorry, I can't. When I installed it there was no message that said I had to deinstall the old version first, and with other Adobe CC applications there had been no trouble at all, so I installed it with The previous version still on my computer.
After installing, neither of them would start up properly, so I deinstalled version XI, after which the old version worked again, but my Adobe Application Manager does not let me download the XI version a second time, so I cannot try again.
Regards,
Marc
Op 7 dec. 2012 om 00:41 heeft David Kastendick <[email protected]> het volgende geschreven:
Re: Easier and better ways to solve current problems with Acrobat?
created by David Kastendick in Acrobat Installation & Update Issues - View the full discussion
The description of the issue you originally presented isn't something that I've seen happen to Acrobat when installed as a part of Creative Cloud.
Could you provide a specific description of the behavior that occurs when you launch Acrobat XI now?
Thanks,
David
Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4902597#4902597
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4902597#4902597
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4902597#4902597. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Acrobat Installation & Update Issues by email or at Adobe Community
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746. -
Hello! I have a MacBookPro5,1. I recently had to erase the disk and start over. So right now I have OS X 10.5.5. what is the best(cheapest/fastest) way to get current on my OS to be able to use current websites and programs? thanks!
Right now there is pretty much nothing on it, and I cant download basic things.Upgrading to Snow Leopard
You can purchase Snow Leopard through the Apple Store: Mac OS X 10.6 Snow Leopard - Apple Store (U.S.). The price is $19.99 plus tax. You will be sent physical media by mail after placing your order.
After you install Snow Leopard you will have to download and install the Mac OS X 10.6.8 Update Combo v1.1 to update Snow Leopard to 10.6.8 and give you access to the App Store. Access to the App Store enables you to download Mavericks if your computer meets the requirements.
Snow Leopard General Requirements
1. Mac computer with an Intel processor
2. 1GB of memory
3. 5GB of available disk space
4. DVD drive for installation
5. Some features require a compatible Internet service provider;
fees may apply.
6. Some features require Apple’s iCloud services; fees and
terms apply.
Upgrading to Mavericks
You can upgrade to Mavericks from Lion or directly from Snow Leopard. Mavericks can be downloaded from the Mac App Store for FREE.
Upgrading to Mavericks
To upgrade to Mavericks you must have Snow Leopard 10.6.8 or Lion installed. Download Mavericks from the App Store. Sign in using your Apple ID. Mavericks is free. The file is quite large, over 5 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
OS X Mavericks- System Requirements
Macs that can be upgraded to OS X Mavericks
1. iMac (Mid 2007 or newer) - Model Identifier 7,1 or later
2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) - Model Identifier 5,1 or later
3. MacBook Pro (Mid/Late 2007 or newer) - Model Identifier 3,1 or later
4. MacBook Air (Late 2008 or newer) - Model Identifier 2,1 or later
5. Mac mini (Early 2009 or newer) - Model Identifier 3,1 or later
6. Mac Pro (Early 2008 or newer) - Model Identifier 3,1 or later
7. Xserve (Early 2009) - Model Identifier 3,1 or later
To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
Are my applications compatible?
See App Compatibility Table - RoaringApps. -
Is there a way to get back a previous iTunes backup file than the most recent Backup?
I did a manual backup and wanted to restore the iPhone, but iTunes forced me to update the iPhone before allowing me to restore the iPhone...
After updating, I realised that iTunes created a backup automatically without confirming with me, and now the latest backup file is not the one I wanted.
Is there a way to get back the backup file I manually backup?Is there a way to get back a previous iTunes backup file than the most recent Backup?
No, to the best of my knowledge the device backup area is simply updated with new information each time the device is backed up so there are no previous versions preserved. Once a backup has been used to restore a device however it gets locked and dated so that you could return back to that snapshot at a later date.
Your manual backup should have simply updated the backup with any new data since the last automatic backup. Upgrading should not have overwritten a backup taken just before the upgrade with a, presumably, empty state. Have you actually tried to restore the current backup that is available? It may have what you want after all. You might like to try backing up the current state of the device to iCloud first, or if you have access to another computer back it up to that.
N.b. I always disable automatic syncing of devices so that I am in better control of when data starts to be written, and in which direction it flows.
ttt2 -
Report that display 'Net Pay' by Empl for current and previous period.
Hi,
We are looking for a SAP report that display 'Net Pay' by Employee for current and previous period in USA payroll module. If you know of any, pl let me know.
Thanks in advance,
NiranjanThanks Archana and Sikindar.
We knew about this report, however, it gives information one below the other if we run, say for 2 periods, but what we are looking for is something as shown in example below
Empl # Empl # Name Prev Pay period Net Pay Current Pay period net pay.
123 XYZ $ 1200.00 $ 1200.00
256 ABC $ 2000.00 $ 3000.00
We want to run for 2 periods at a time and get the results as above. That way, payroll dept can run this report and compare if we are paying too much in current pay, compared to previous pay. This is basically to avoid any typos when they create new pay records in infotype 0008.
Niranjan -
Can't seem to find a way to get rid of previous senders' email addresses before myself forwarding on the email. I used to be able to do this before I upgraded. Any ideas?
Current Firefox versions have enabled a new build-in PDF Viewer and that viewer doesn't have all the features that the Adobe Reader has.
You can change the action for Portable Document Format (PDF) from Preview in Firefox to use the Adobe Reader or set to Always Ask.
*https://support.mozilla.org/kb/change-firefox-behavior-when-open-file
You can set the pdfjs.disabled pref to true on the <b>about:config</b> page to completely disable the build-in PDF viewer and use the Adobe Reader instead.
See also:
*https://support.mozilla.org/kb/view-pdf-files-firefox-without-downloading-them -
Selective deletion in DSO for current and previous year
Hi,
Can any one give an idea how can I selectively delete current and previous year data (only). is there any process type that can help me in process chains. This should be before loading a fresh load for the same period. this is for psodo delta.
or
any other alternative, plz. suggest.
Thanks
ganesh
Edited by: Ganesh on Jul 7, 2008 12:08 PMHi,
If you have any date value example posting date or 0CALMONTH.., you can filter the date using the selection conditions and selectively delete the data.
Process:
Manage of DSO->Contents Tab->Selective (with delete Icon)->Deletion selections->give the period->Execute->Start->Yes->continue.
Hope this helps..........
Rgs,
I.R.K -
No sound. Mute is not checked, volume all the way up on iTunes and on status bar. What am I doing wrong or missing? I restarted last night and it worked before that but not since, any one have any ideas?
Thanks, RobFirst off did you go to System Preferences > Sound > Output > And is the correct output selected?
Any red light coming out of the headphone jack? If so, you'll need to re-set the little switch in there by inserting a 3.5mm jack carefully in & out 20 odd times. Or grab a toothpick (non-conductive) and a flashlight.
Tried anything else that produces a sound? On restart do you get the chime? Perhaps check into Audio Midi Setup to ensure your output is selected correctly using the cog at the bottom left. -
How to get user and system status for a trade promotion
Hi,
I have to develop a batch program to change user status and system status of all trade promotions which satisfy some criteria. This criteria checks some dates related to trade promotion(like Changed on,Pallett buying, buying horizon dates) also.
I thought of first extracting all external ids from CGPL_PROJECTS table and then run trade promotion query. But how can I get current user & system status and all dates as these can be taken from relations "TPMStatusActiveRel" and "TPMDateRel". I don't know to take data from relations. Please help me with a piece of code.
Thanks.Hello Shikha,
You can use these relations here, as you are not in the Business Object layer anymore. As far as my understanding is, all the batch programs or reports should be done at the API layer. Try this code, to read the status of the Trade Promotion object.
data: lr_appl_base type ref to CL_CRM_MKTPL_APPL_BASE,
lt_sys_status type CGPL_ISTATUS_TEXT_T.
lr_appl_base ?= CL_CRM_MKTPL_APPL_BASE=>GET_INSTANCE().
" To read system status
call method lr_appl_base->STATUS_READ
exporting
IM_MKTELEMENT_GUID = "your Trade promotion guid
ET_TJ02T = lt_sys_status.
" To read user status
call method lr_appl_base->STATUS_READ_EXTERN
exporting
IM_MKTELEMENT_GUID = "your Trade promotion guid
ET_TJ02T = lt_sys_status1.
To change the user status, use the method STATUS_CHANGE_EXTERN of the same class
To set the system status, use the method STATUS_SET of the same class.
Hope this helps.
Regards,
Vinay -
FM which get component and order status & return prod. orders
Hi all
does any one know a FM which get component and order status & return prod. orders?
thankssee the transcation COOIS , i think it will be the details required by you
in the selection at component level block
enter the material no(component) , if required plant and storage location and then execute
hope it will solve ur purpose
so u can suggest for this TCode still u need a custom program u can submit these details from your z program
and get the output
table i am not sure see all these tables AUFK,AFKO,AFPO
cheers
s.janagar
Edited by: janagar sundaramoorthy Nadar on Jul 13, 2009 12:18 PM -
Displaying current and previous 5 Year data in a bar graph
Hi ,
My requirement goes like this .....
I have to show revenue (measure) data based on current year (period dimension) selection (from a dashboard prompt) and previous 5 year data's as well .
i.e. if user selects 2013 , the bar graph will display 6 bars ... 2013,2012,2011,2010,2009,2008.
I am trying to achive this with filter on Year column , on the main report ....*"is based on results of another analysis"*
But haven't made any progress .
Thanks
sayaksayak wrote:
Hi ,
My requirement goes like this .....
I have to show revenue (measure) data based on current year (period dimension) selection (from a dashboard prompt) and previous 5 year data's as well .
i.e. if user selects 2013 , the bar graph will display 6 bars ... 2013,2012,2011,2010,2009,2008.
I am trying to achive this with filter on Year column , on the main report ....*"is based on results of another analysis"*
But haven't made any progress .
Thanks
sayakFollow this link. It will give you greater flexibility for you end users and therefore a better report.
http://oraclebizint.wordpress.com/2008/03/11/oracle-bi-ee-101332-rolling-yearmonth-and-date-filters-moving-window-filters/ -
12 month but devided into current and previous year
hi guys
i have this requirement to disaply amount for current period and previous period for 12 month.
Current period is the period of user entered year and previous period is previous year
So if user enter feb 2007 u2026Then current year is feb, jan ,dec 2006
And previous period is Nov 2006 to March 2006
user is entering the value 0CALMONTH ...and report to need to display 12 month internval betwen years. my problem is how to check the year and interval
please help me without any custom exit? can it be possible thru varibale?Hi,
I think i misunderstood your question previously.
You can create offsets on CALMONTH and achieve this easily.
1)In the columns are of query disigner, create selections for 12 months by using CALMONTH and offset each field by -1 or -2,-3,-4 ..... -12.
2) Create a Text Variable to show the month Value in column header
3) Create a structure in columns area and place it below all the CALMONTH selections
4) Include all your Key Figures inside the structure. -
Hello everybody,
I am SAP XI Architect. I am analyzing an interface for customer balances. I have a requirement to send the Current balance and Previous balance to 3rd party tool. The previous balance is till last transaction period (for example: till last quarter or till last month). In which Transaction I can find this balances?
With my little FI knowledge I tried these T-codes FD10N, FS10N, F.08... Can I find my requirement in this T-codes?
Thanks in Adv,
Greetings
XI/PIHi, KE24 gives the details, if you just want to know the details. You need to give the operating concern. Record type F (billing), company code and the period for which you want to know the balance.
You need to change the layout for sales order and Product. Hope this helps. -
IPod shuffle current and previous gen
I was going through the Apple Store's refurb iPod site and saw that the current generation iPod shuffle and previous generation iPod shuffle look exactly alike. They're of the clip type. Now, what has actually improved in the current generation of the iPod shuffle?
Frank F. wrote:
The latest iPod shuffle was never claimed to be of a new generation at all - it still belongs to the second generation. However, there have been a number of minor revisions within this generation:
a) Original: Silver only, 1 GB, old headphones
b) Neon color models added, new headphones
AppleStore refurbs page calls this the "previous generation"
c) Neon colors replaced by pastel colors
AppleStore refurbs page calls this the "current generation"
d) 2 GB model added, price cut
Price was cut before 2GB was actually available, although announced
simultaneously with price cut... -
Hi,
As I said, recent graduate. Not a lot of disposable income. I require Photoshop and After Effects to progress in my career. What's the best way to get these two programs with creative cloud?
Thanks!
EllieThere is a special photographers plan, and then buy a single item subscription for After Effects
Cloud Plans https://creative.adobe.com/plans
-and subscription terms http://www.adobe.com/misc/subscription_terms.html
Maybe you are looking for
-
Hello! I am new to LabView and I am struggling with this problem for a couple of days... I have a 2D array CH x spike_time and on each row (1D array) I need to implement a logic that requires the possibility to dynamically initialize two indexes.
-
Content server and shared folders on win2003
Hi I am new to DMS server. Is content server show the files in the shared folder ? is there any option to trying this ? In cv02n can we move the documents in shared folder to database ? need help
-
Are submissions to HTML DB studio reviewed regularly? If a submission is not accepted, does the contributor get a polite response stating the reason? I submitted a modified version of the Command Line export utility to the Studio many weeks back. Sen
-
IMac yosimite aperture slow to open
my yosemite aperture very to open
-
All, I have an application which has a form where users submit accounts for review. It is working great and populates a table in my schema, but of course we need to have these accounts reviewed by my team. I am attempting to design a button that will