How to determine minutes per week with inconsistent start and end times...

ver -> 10.2.0.4
I'm looking for some guidance or some pseudo code in how to attack the following:
Data
target_nm  status       start_timestmap       end_timestamp
DEVDB      Target Up    8/28/2009 9:49:08 AM  9/26/2009 6:34:23 PM
DEVDB      Target Down  9/26/2009 6:34:23 PM  9/26/2009 6:36:23 PM
DEVDB      Target Up    9/26/2009 6:36:23 PM How can I display, per week, the number of minutes a status was held? There are 10,080 minutes per week and I'm using to_char(to_date('8/28/2009 9:49:08 AM', 'mm/dd/yyyy hh:mi:ss AM'), 'WW') to determine the week number. The end result would be something like, in example:
target_nm   wk    up           down
DEVDB       35    [x minutes]  [y minutes]This, at first, seemed pretty straight forward, but where it gets wrapped around the axle is that the records of a status can span a number of weeks between the 'start_timestamp' and the 'end_timestamp.'
My current approach is to isolate this down for a given day...if something is "started" then determine the number of minutes between trunc(start) +1 and start . If it has "ended" then determine the number of minutes between trunc(ended) and end.
Resulting in something like:
target_nm    status     day_of_year  minutes_of_status start_timestamp       end_timestamp
DEVDB        Target Up  8/27/2009    296.3333          8/27/2009 7:03:40 PM  nullAny advice, a different perspective, or pseudo code would be greatly appreciated on how to turn the corner on showing these status's as they break down per week.
Regards,
-abe

Hi,
As you said, you just need to compute SUM (end_timestamp - start_timestamp), GROUPing BY week.
The tricky part is what happens when an event is not entirely within one week. For example:
DEVDB      Target Up    1/07/2009 11:00:00 AM  1/08/2009 2:00:00 PMThis event lasted 3 hours, but you want to count this as 1 hour in week '01', and 2 hours in week '02', not as 3 hours in either week.
The solution is very much like the one in the following thread:
[8i] Date/Time calculation problem...
Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
Edited by: Frank Kulash on Mar 16, 2010 12:16 PM

Similar Messages

  • PowerShell - Get-MessageTrackingReport how to specify start and end time of current process

    could you please help me? I need to specify start and end time of current process with Get-MessageTrackingReport command. I know you
    can do it with Get-MessageTrackingLog:
    $start = (Get-Date).Addhours(-1)
    $end = (Get-Date)
    Get-MessageTrackingLog -EvenId Receive -Start $start -End $end
    But for my purposes I really need to do it with Get-MessageTrackingReport command, so how can I do it?
    Thanks in advance!

    That's not the context you would use
    Get-MessageTrackingReport in,
    Get-MessageTrackingReport is used to get extra information on messages that you have found in the MessageTracking log using Search-MessageTrackingReport . That's why the most common example you see will look like
    $Temp = Search-MessageTrackingReport -Identity "David Jones" -Recipients "[email protected]"
    Get-MessageTrackingReport -Identity $Temp.MessageTrackingReportID -ReportTemplate Summary
    The most important parameter for that cmdlet and the reason it won't work like your trying to use it is the
    Identity ""The Identity parameter specifies the ID of the message tracking report ID to retrieve.You should run the Search-MessageTrackingReport cmdlet
    to find the message tracking report ID for the specific message you're tracking, and then pass the value of the MessageTrackingReportID field
    to this parameter." see http://technet.microsoft.com/en-us/library/dd351082%28v=exchg.150%29.aspx
    It's more appropriate to use Get-MessageTrackingLog when you want to search the log based on time or use
    Search-MessageTrackingReport and then limit the results this returns before you pass the MessageTrackingReportId to get-MessageTrackingReport
    Cheers
    Glen

  • How to get start and end time of an ESB instance in SOA 10.1.3.4

    Hi All,
    I am using soa 10.1.3.4 and want to track the esb instance start and end time. (For example, in case of bpel we can query the cube instance table to get creation and modify time of an instance. )
    How to get that in esb?
    Thank you.
    Regards,
    Satish

    Hi Satish
    You may enable instance tracking option on the ESB Console and track the instances audit information and also from the logs(log.xml) when ESB loggers are set to DEBUG mode.
    Regards
    A

  • Why can't I set calendar events with start and end times down to the minute?

    Hi everyone
    Unless I've missed it, it's not possible to set events that have times that start and end to the minute rather than 5 minute slots.  I work shifts that start at individual minutes. 
    Is there actually a way of doing this, other than on my Mac?  Siri is a far too long-winded way of doing it. 
    Thanks

    Do you not get this popup sheet where you can set the number and timeframe?

  • How to return start and end time in Unix epoch format

    Hi: I have a integer field (utime) in a table that stores the UNIX epoch time for a record. Every sunday around 2:00AM, I am running a query which should return records from last week. I want my condition to have the following in it's where
    WHERE utime between
    (convert sysdate-7 12:00AM to Unix time)
    AND
    (convert yesterday 11:59PM to Unix time)
    Can someone help me create this convert?
    Thanks
    Ray

    Yes, you seem to have worked out the logic of the expression correctly. Though, in your earlier post you had said that you want records within the range:
    WHERE utime between
    (convert sysdate-7 12:00AM to Unix time)
    AND
    (convert yesterday 11:59PM to Unix time)But now you are adding 14400 (4hrs) and deducting 72000 (20hrs) in your expression
    SELECT * from TABLE
    WHERE utime between
    ((TRUNC(SYSDATE,'DD')-TO_DATE('01/01/1970','MM/DD/YYYY'))*(24*60*60))+14400 AND
    ((TRUNC(SYSDATE-6,'DD')-TO_DATE('01/01/1970','MM/DD/YYYY'))*(24*60*60))-72000;Which makes your new condition to be:
    WHERE utime between
    (convert sysdate 04:00AM to Unix time)
    AND
    (convert sysdate-7 04:00AM to Unix time)
    Are you sure you need records from 4am-to-4am and not midnight-to-midnight? And yes, with BETWEEN condition you need to use expression '<low-value> AND <high-value>' and not '<high-value> AND <low-value>'!
    Besides this,
    1. You might want to use bind variables rather than hard-coded expressions in your statement. Infact your expression uses SYSDATE, so Oracle would need to get current SYSDATE for each row to evaluate the expression. Which is going to have its impact on performance. As your start-time and end-time values are not dependent on table data maybe you could have a code like this (assuming it is PLSQL code):
    start_time constant number := (convert sysdate-7 12:00AM to Unix time);
    end_time constant number := (convert yesterday 11:59PM to Unix time);
    <DML or Cursor with condition>
    WHERE utime between start_time and end_time;
    2. You said that your table already has values in unix-epoch-time in column 'utime'. How are these values inserted in the first place? Is there a function in your application that converts any given time to unix-epoch-time? Is yes, then use that in your code.
    3. If such a function does not exists, than rather than using hard-coded expressions it might be a good idea to create new functions for converting to and from unix-epoch-time and to get current unix-epoch-time from server.
    Using a function in the above case:
    start_time constant number := f_convert_to_unix_time( trunc( sysdate-7 ));
    end_time constant number := f_convert_to_unix_time( trunc( sysdate )) - 1;
    <DML or Cursor with condition>
    WHERE utime between start_time and end_time;
    And lastly, some of us might not know about Unix time, so here is a useful link http://en.wikipedia.org/wiki/Unix_time

  • How do you set a start and end time based on changes in data averages?

    I am making a VI to collect data from a calorimeter that will detect automatically when I have triggered the combustion by recognizing a rise in the average temperature, and then will record data from that point until it the temperature rise stops or plateaus. I have worked out how to average my data, how to write it to a file, etc. but I don't know what the best way to construct my VI to automatically respond to changes in the average would be. It seems to me that there are a number of ways to do this, but I am fairly inexperienced with LABView and don't know which is best.
    Does anyone have any ideas, specific advice, or general thoughts about using fluctuations in data averages to set start and stop times for a VI?

    Lynn,
    All great points - thank you for your thoughts. You are right, I am interested in selecting a subset of my data in which the temperature is rising, not setting start and stop times.
    I realize that it is difficult to give concrete advice without more information, but I'm hoping that with some clarification on my part you might be able to give a few suggestions. The calorimeter I am working with is a microbomb calorimeter, which combusts small, dry biological samples in a pressurized, oxygen environment, and it does not have a water tank or other components on other bomb calorimeters. The data I am recording is mV signal from a thermocouple ring that the microbomb rests in. To directly answer your questions, I would say I am measuring detonations, or more specifically the electrical potential generated in the thermocouple due to the temperature increase of the stainless steel bomb. The data is fairly noisy, so I have previously been averaging every 1000 data points together in order to observe the temperature increase clearly.
    The only plateau in the data that I have observed that I need to deal with is at the peak of the temperature increase, when I would like to put my second timestamp/end my data subset. There is a slight lag time due to the rate that the steel heats at, so the entire measurement can take 30-40 seconds even though the combustion occurs in seconds. What I would like to do is have my VI observe and respond to the averages that it is already making, and then by some means, like an increase/decrease beyond one or two standard deviations, for example, and then set the datapoint before the increase as Time 0. Then I would like to identify the end of the temperature increase/end of the datasubset by similar means as the increase levels off. Finally, I want to integrate the curve of the increase and display the integrated value for my users.
    I would appreciate any thoughts. I don't have any raw data to share, but I do have a TDMS of the averaged data from a calibration test I did combusting benzoic acid. I'm not sure how much it will help, but I'll attach it regardless.
    Thanks,
    ~nat
    Attachments:
    benz_test.zip ‏76 KB

  • Custom text component with different start and end points for each line

    I'm trying to create a custom component extending textArea in which each individual line in the textArea would have different start and end points.  For example, the start/end points for line 1 might be 20 pixels in the front and 35 pixels at the end but start/end points for line 2 might be 25 pixels in front and 20 pixels at the end, etc.  These boundary values would be passed in.  The width of the entire textArea component would be a fixed size.  The result would be something like this:
         Jack and Jill
              ran up the hill
      to fetch a pail of water
    depending on the boundary values of each individual line of course.  The custom component would take a string and render it in the text component with the appropriate individual line start and end points.  I'm trying to do this by adding the text component to the display with the passed in string and then adding in spaces in the beginning of each line and adding a "/n" at the end of the line wherever appropriate based on the start and end values for that line.
    Just wondering if I'm on the right track and if anyone has any advice on this.

    > Applying the marker places the same icon on all lines of the graph and I need a different one for each
    What do you have selected when you assign the marker? It
    shouldn't apply to all the markers on the whole graph unless you have all the existing markers selected when you apply the new one.
    Assigning marker designs is exactly analogous to assigning bar graph designs.
    If you have a single marker selected when you assign the new design, it will apply to only that graph data point.
    If you use the group select tool (or option-click with the direct select tool) to reclick on an already-selected marker until all the markers for the same line are selected, and then assign a design, the new design will apply only to the selected line. (You can extend the graph by adding more rows, and the new data points will inherit the marker for the line they are on.)
    The thread linked to below demonstrates in more detail how the marker designs are scaled:
    http://www.adobeforums.com/cgi-bin/webx/.3bc10970/0

  • How can I control the video playback start and end time?

    I'd like to be able to start a video/audio playback at a particular point in time say 3 seconds from the starts of the video and play it for only 3 seconds. How can I set the unique start and end points rather than play the whole video. I'd also like to be able to do this using the SeriesElement so I can set the start and end play points for a series of stacked videos. How can this be achieved?

    Not sure I understand the question.  Can't you just append the param to the URL?  Like so:
    var url = new URL("http://video-research/video.f4v?start_time=500");
    If your question is more about playing a subclip of a progressive video, that's not something OSMF has support for.  You'd need to write a server script which checks for that parameter and then returns the relevant portion of the requested file.  (This is typically referred to as "pseudo-streaming", if you Google that term you'll find a wealth of info.)

  • Start and End Time in Record Working Time- Weekly View

    HI,
    In record working time we have 2 views, daily and weekly. In daily view, we have start time and end time, which we do not have in weekly view. Can these 2 fields be incorporated in Weekly View?

    Hi Siddharth,
    Can you please clarify what "iView development using NWID" really means?
    - Is that Java Web-dynpro development? - Can it be either Java Web-Dynpro or ABAP web-dynpro?
    - Does it mean that we have to customize the standard-delivered “record working time” application, or does it mean that a custom copy of the application needs to be developed?
    Thank you!
    Daniel.

  • How to print a monthly calendar with start and end times

    Hi,
    I'm trying to print my monthly calendar and the times of the appointments do not show up.
    Am i missing something?

    It looks like we're not alone in looking for this feature. I found 28 other posts to this forum alone asking for this functionality (dating back to August 2005).
    I know Apple likes to be different and elegant with their apps, but until iCal adds this trivial feature, it's not an adequate replacement for even paper calendars.
    Do the engineers in Cupertino not care how long their appointments last? Why not at least let users show the end time on appointments as an option in month view?
    The most common advice in response to this post is to provide feedback here:
    http://www.apple.com/feedback/ical.html
    In case anyone is interested in seeing what others have said about this topic, here are the posts I found after doing a few quick searches (I'm sure there are plenty I missed):
    http://discussions.apple.com/thread.jspa?messageID=1030412&#1030412
    http://discussions.apple.com/thread.jspa?messageID=1030751&#1030751
    http://discussions.apple.com/thread.jspa?threadID=1152286
    http://discussions.apple.com/thread.jspa?messageID=1155931&#1155931
    http://discussions.apple.com/thread.jspa?threadID=1362352
    http://discussions.apple.com/thread.jspa?threadID=1366825
    http://discussions.apple.com/thread.jspa?threadID=1381246
    http://discussions.apple.com/thread.jspa?threadID=1484562
    http://discussions.apple.com/thread.jspa?threadID=1514356
    http://discussions.apple.com/thread.jspa?threadID=1528581
    http://discussions.apple.com/thread.jspa?threadID=1682474
    http://discussions.apple.com/thread.jspa?threadID=1712206
    http://discussions.apple.com/thread.jspa?threadID=1724963
    http://discussions.apple.com/thread.jspa?threadID=1807661
    http://discussions.apple.com/thread.jspa?threadID=207083
    http://discussions.apple.com/thread.jspa?threadID=2109562
    http://discussions.apple.com/thread.jspa?threadID=2136612
    http://discussions.apple.com/thread.jspa?messageID=2401772&#2401772
    http://discussions.apple.com/watches!add.jspa?forumID=903&threadID=340438
    http://discussions.apple.com/thread.jspa?threadID=340499
    http://discussions.apple.com/thread.jspa?threadID=349227
    http://discussions.apple.com/thread.jspa?messageID=4523541&#4523541
    http://discussions.apple.com/thread.jspa?messageID=5443615&#5443615
    http://discussions.apple.com/thread.jspa?messageID=6438793&#6438793
    http://discussions.apple.com/thread.jspa?messageID=6561666&#6561666
    http://discussions.apple.com/thread.jspa?messageID=7032709&#7032709
    http://discussions.apple.com/thread.jspa?messageID=7236371&#7236371
    http://discussions.apple.com/thread.jspa?messageID=8158161&#8158161
    http://discussions.apple.com/thread.jspa?messageID=8691178&#8691178

  • I have omf video files with start and ending time tag that I like to view on iPad

    I have a large video file in the .omf (open media format).  It is sometime called Avid video editor interchange.   I heard that Quicktime has the ability to display the omf video file ??
    I am looking for a viewer for the iPad that can view the omf file with the ability to just show the starting time stamp to the ending time stamp.
    I appreciate any help.
    Thank You

    http://support.apple.com/kb/ht5209
    http://support.apple.com/kb/ht4437
    http://support.apple.com/kb/TS4215
     Cheers, Tom
    Oops!!!!!! Just realized Airplay & Apple TV requires iPad 2 (or later).
    Message was edited by: Texas Mac Man
    But there may be a way. http://www.youtube.com/watch?annotation_id=annotation_586623&feature=iv&src_vid= urjjHjJ0pdc&v=sSKQVxucnLY

  • Difference of last 2 Rows with Start and End Time

    Hi all,
      This question is an extention to the below question
    http://social.msdn.microsoft.com/Forums/en-US/ca938faf-49a7-4212-afd2-19046cbfcc8b/difference-of-last-2-rows?forum=transactsql
    I got the difference of last 2 rows from the above question. But now the table added with one field StartTime. The final table is
    CREATE TABLE MeterReading
    ReadingID int,
    MeterID int,
    DataCounter int,
    StartTime datetime,
    Value numeric(16,4)
    As per the my first thread i got the best answer like below
    SELECT MeterID, SUM(CASE WHEN Recency = 1 THEN Value ELSE -Value END)
    FROM (
    select DISTINCT MeterID, Value, DENSE_RANK() OVER (PARTITION BY MeterID ORDER BY StartTime DESC) 'Recency'
    from MeterReading
    ) x
    WHERE Recency IN (1,2)
    GROUP BY MeterID
    Now i need to add StartTime to the result. The expectation is, it will take the difference of last and second last record. So i need the starttime as secondlast record starttime and endtime as last record startime. Please help me

    I got a solution like below
    SELECT
    y.ProcessParameterID
    ,MIN(y.StartTime) StartTime
    ,MAX(y.EndTime) EndTime
    ,SUM(y.Value) Value
    FROM
    SELECT
    ProcessParameterID
    ,(CASE WHEN Recency = 2 THEN StartTime ELSE null END) StartTime
    ,(CASE WHEN Recency = 1 THEN StartTime ELSE null END) EndTime
    , SUM(CASE WHEN Recency = 1 THEN Value ELSE -Value END) Value
    FROM (
    select DISTINCT ProcessParameterID, StartTime, Value, DENSE_RANK() OVER (PARTITION BY ProcessParameterID ORDER BY StartTime DESC) 'Recency'
    from LT_LAEMI_HWT_Readings
    ) x
    WHERE Recency IN (1,2)
    GROUP BY ProcessParameterID
    , Recency
    , StartTime
    ) y
    GROUP BY ProcessParameterID
    Can you advice me, is this the correct way or any alternative short method

  • How to create a join like: year between start and end

    Hello all I have got a dimension and a fact.
    normally in sql I would use the following:
    fact.year between dimenstion.start_year and dimension.end_year
    When I use this, then OBIEE says I have to use operators
    So now I am trying:
    fact.year > dimension.start_year and fact.year < dimension.end_year
    But now OBIEE is saying that I must use the equel operator...
    My question is how can I make this type of join?

    Thanks for your quick answer... I am trying this now...

  • How do you get start and end times to show

    is there a way the start and finish times of each event daily will show on the monthly view of Ical

    AFAIK only the start time can show. (Preferences>General, check 'Show event times in Month View'.)

  • How do I stop calendar inserting 'starts' and 'ends'

    I have recently bought a new laptop ( OS Yosemite version 10.10.2) and find the automatic entering of 'starts' and 'ends' times on my entries in calendar very irritating.
    How do I stop it doing this ?
    The previous version I used did not do this automatically by default.

    I had the Integrated Gmail 2.5.5 addon enabled.
    After disabling the addon the problem is gone.
    Hope it works to you guys.

Maybe you are looking for

  • Sending a message to a users email

    Hi, I need a little script that sends a link adress to a users email as soon as he/she presses a submit button. I have to create a form element for the email (of course) and a PHP-script that somehow attaches/sends the link from a textfield in EA whe

  • Inventory cycle count report

    Hi We need to implement inventory cycle count report . Is there a standard business content data source for this ? Thanks and Regards Arun

  • TS1702 Problem in iPad 2

    I have an apple iPad 2. Now a days I am facing a problem that an icon is in my desktop which has no name also it dose not open. I can't find which software was it. I can't delete the icon also I can't find it in my laptop iTunes. So is there any ways

  • How can I stop broadband phone ringing with landli...

    If you call the broadband number only the broadband phone rings - which is what I want. But when you call my landline number both the landline phone and the broadband phones ring. I want just the landline phone to ring when you call the landline numb

  • Display foerign characters

    So i have a bunch of cd's from japan, korea and china that i want to import into itunes. When i try and do that, the song names and artists just show up as boxes. How do i go about displaying the characters? my default language is english. Many thank