Calculate stay duration in Answers

Dear Reader,
I trying to solve the following problem and am blocked:
We have a set of objects (1,2,3,...) and a set of knot (A,B,C,...). Each object is going from one knot A to knot D, then staying at knot D for a time period and is going to knot K (A,D and K stay for a random path between knots).
My database has the following structure:
TableA:
-object_ID
TableB:
- departure knot
- departure time at departure knot
- Arrival knot
- Arrival time at arrival knot
(TableA and TableB are connected through a join...)
Now I want to query my database for a certain datetime in order to know which object is at which place and for which duration (total duration, or duration left, or since when). My problem lies in the calculation of the duration. How can I realize the query for a datetime with object_A AND arrival_time in knot_K < departure_time in knot_K?
Any help is greatly appreciated
Evgeny

@john
I don't think that a CONNECT BY PRIOR will resolve the problem because in this kind of statement you can't use the data from the parent in the child row (may be they have made improvement ?). And in this way, you can do the comparison arrival, departure because arrival will be on the parent row while departure will be on the child row. No ?
@evgeny
I think that you have a problem in your model. You would never ask this question, if you had as table B :
- object_ID
- knot
- Arrival time at knot
- departure time at knot
And as said john, you just need to create a table of type view in the physical layer with a self join as :
select
arrival.object_ID,
arrival.Arrival knot
arrival.Arrival time at arrival knot
departure.departure time at departure knot
from
tableB arrival,
tableB departure
where
arrival.Arrival knot = departure.departure knot (+)This view will then replace your tableB and you can answer all your questions.
Cheers
Nico
Edited by: gerardnico on Jul 16, 2009 9:03 PM replace say by said

Similar Messages

  • Best way to calculate a duration

    Hi Everybody,
    loading data I have to calculate a key figure as a duration..it means as result from the difference between a start and end timestamps..
    how do you think would be the best way to calculate this keyfigure?
    I would rather prefer to do it in the update rule..
    I am going to appreciate any idea.
    Best regard,
    FedeX

    Hi
    It all depends upon the requirement. If you have a separate key figure in cube and you are calculating the value in update run it will increase the size on the cube a bit and loading process but will help to run the query fast. But if you create a calculated key figure on cube when you execute the query the value is calculated when query is running and increase query execution time.
    So it’s a kind of trade off to see how often you run query and often you load cube
    Thanks

  • How to calculate call duration using java card API

    Hi,
    I am developing an application using Java card API. I want to calculate duration of otgoing calls in it. I am trying to start timer at the beginning of call in Call Control event. Can someone kindly check following code of Call control event? Here timerManagement function is sending proactive command for starting timer for 3 hours. Here I am asuming that maximum call will be of 3 hours. In callDisconnect event i can get current value of timer and use it to calculate duration of call. But this scenario is also not working.
    Problem is that during code execution program stuck at send command (proHdlr.send();) of timmerManagement function. I am sending postAsBERTLV command before starting timer so may be reason is that it is not possible to send proactive command while phone is busy.
    But I also cannot send postAsBERTLV after timerManagement function. Because it is mention in specification that "The EnvelopeResponseHandler content must be posted before the first invocation of a ProactiveHandler.send method or before the termination of the processToolkit, so that the GSM applet can offer these data to the ME (eg 9Fxx/9Exx/91xx). After the first invocation of the ProactiveHandler.send method the EnvelopeResponseHandler is no more available"
    Take a look at following code
                     * Method illustrating the use of the Call Control event.
                    private void callControlService() {
                                    /** @todo: Replace following sample code with your implementation */
                                    ProactiveHandler proHdlr = ProactiveHandler.getTheHandler();
                                    EnvelopeHandler envHdlr = EnvelopeHandler.getTheHandler();
                                    ProactiveResponseHandler rspHdlr = ProactiveResponseHandler
                                                                    .getTheHandler();
                                    EnvelopeResponseHandler envRspHdlr = EnvelopeResponseHandler
                                                                    .getTheHandler();
                                    durationCount = 0;
                                     // allow call with no modifications
                                    envRspHdlr.postAsBERTLV((byte)0x9F, (byte)0x00);
                                    // start clock using timer
                                    timerManagement(proHdlr, rspHdlr, (byte) 0x0, timer_id, tempBuffer);
                                    return;
                    }Please help me in this regard
    Thanks
    Yasir

    I am also unable to start timer in call connected event. I cannot send any proactive command while phone is busy. I am using Gemalto development Suite and there simulators (Simulation 2G chain).
    Is it limitation of simulator that you cannot send any proactive command while phone is busy?
    Is there any other work around for getting call duration?

  • How does the nano calculate walk duration?  It doesn't match finish minus start

    I started using the 7th gen nano to track steps during the day.  However, the reported duration never matches how long I've been tracking steps.  I've had the walk tracker on for 5 hours today, but the reported duration is only 2 hours.  I recorded a 15 hour session yesterday, but it only reported just under 8 hours of duration.  Is it only reporting the duration it sensed movement?  Or is something else going on?  I've never seen the duration counter stop ticking, but it's obviously not reporting the difference between start time and end time.

    Oops sorry my bad about saying you were averaging averages, just had that on the brain as a client was doing that a little while back which was frustrating. Taken from the stored procedure for that report:
    Avg_Handle_Time = (th.totalhandletime / th.callshandled)
    FYI:
    totalhandletime = sum(tacdr.handletime)
    callshandled = count(cqdr.sessionid)
    handletime = acdr.talktime + acdr.holdtime + acdr.worktime
    Find out how
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:"Times New Roman";
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;}
    IEX TotalView calculates it's AHT and see if it uses the same calculation
    In regards to queuing to multiple CSQs. A call can only be handled in 1 CSQ even if it is queued to multiple. So if a call is queued to CSQs ABC and XYZ, if it is answered via ABC the call disposition (in the ContactQueueDetail table) will be as follows:
    ABC: Handled by CSQ (disposition = 2)
    XYZ: Handled by another CSQ (disposition = 5)
    Cheers,
    Nathan

  • How to calculate the duration/age of a work request.

    I need to calculate the actual resolution time in 'Days:Hours:Minutes' format, for the work requests which are being worked upon by the engineers working in my team. I am using MS-Excel (MS-Office 2013) for reporting. The tool from which I am exporting
    the details shows the Open and Resolved time as MM/DD/YYYY HH:MM:SS (3/20/2015 10:32:16 AM). I am sure this is one of the thing which is not that difficult and many reporting people are doing this. Thanks in advance for the assistance.
    Regards, Ankit Arora

    Let's say that the Open date/time is in A2 and the Resolved date/time in B2.
    The formula for the resolution time is =B2-A2
    Format the cell with the formula with the custom number format d:hh:mm
    This will work as long as the number of days is at most 31.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • In the middle of writing an e-mail, a pop-up occurred asking me whether I really wanted to leave the current page. I kept clicking on the stay-on-page answer, but it wouldn't respond.

    After trying MANY times to get it to work, I tried to shut down my computer. Firefox prevented this and shot me back to their pop message (which wasn't responding to my attempted answer). It wouldn't accept any answer (stay or leave).

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Audio from apps stays on when answering a call

    Prior to the update to 4.1.2 build JZ054K.I535VRBMF1, when a call would come in and I was listening to audio through a streaming app like Sirius or MLB At Bat, the audio would turn off until I was off the call.  Now, when I pick up the call, the audio continues playing until I shut it off.  Does anyone have a fix for this issue?

    Give Running a System Cache Clear a Try and if you haven't shut your phone down Lately you might try that as Well actually i would try that before the Cache Clear..

  • Not urgent time difference  and duration  1970 is annoying me

    hello
    I have been trying to calculate the duration between t0 and now .I have tried everything
    but I'm having one hour more .
    here is the last test I have done
    SimpleDateFormat df=new SimpleDateFormat("hh:mm:ss");
    String arriving;
    String now;
    Date d1,d2;
          try
             arriving="10:15:20";
             now="10:30:20";
             d1 = df.parse(arriving);
              d2=df.parse(now);
          } catch (ParseException ex)
             ex.printStackTrace();
    Date dd = new Date(d2.getTime() -d1.getTime());
    System.out.println("duration   dd   is "+ dd);here is the result i get
    Thu Jan 01 *01*:15:00 CET 1970
    normaly I need to have Thu Jan 01 *00*:15:00 CET 1970
    thank you in advance
    ps:I have tried better or other ways ,but I get always this one "1" before

    linuxchild wrote:
    I have added this ,and now I get red of the 1 ,but could any one confirm me if this will work on the winter time also ????
    Date dd = new Date(d2.getTime() -d1.getTime() --(3600000 ));
    This will only work for computers in your time zone, since you are hardcoding the offset.
    Instead, I encourage you to use the same time zone for all of your computations so you don't have to deal with it.
    You should be able to pass the time zone as an argument to the date strings that are being parsed.
    Edit: warnerja beat me to it.
    Edited by: Jin on Oct 16, 2007 11:19 AM

  • Slideshow: Setting Image Default Image Duration

    Howdy All!
    I am again attempting to create a slideshow on FCE and it has been almost a year since I last used FCE. I have forgotten if there is a way to set the default duration of still images either as I import them into FCE or as I move them to the timeline.
    I will also need to set a default duration for my transitions.
    Does anyone know if there is a simple way to calculate how much inserting a transition will affect the duration of images. I know from past experience that if I calculate the duration of my still images so that a section of slide show is a specific length and then add in transitions, they will actually shorten the total duration of that section.
    Thanks
    HPL

    It will only change new images as we said.
    Regarding all the transitions, there is a way to streamline the process:-
    1. Put all slides in Timeline.
    2. Make your transition a Favorite.
    3. Click on the first "join" and add the transition.
    4. Press the Down Arrow and the playhead will jump to the next "join".
    5. Drag the Favorite from the Browser and drop it over the "join".
    Keep repeating steps 4 and 5. It is extremely quick taking less than 5 seconds each and getting quicker with practice. You should be able to do the whole lot in well under half an hour.
    Message was edited by: Ian R. Brown

  • Can someone help me with a simple duration calculation?

    I created a simple workbook for calculating hours worked. I am entering the start time, end time, and using the DUR2HOURS formula to calculate the duration. For some reason the calculation is wrong. I am sure it is somethign simple, but I could not find an answer and it has been bothering me for a couple of days now. Here is an example of what is happening:
    Start Time     |     End Time     |     Duration
    7:15 AM               5:30 PM               10.25  (formula: =DUR2HOURS(ENDTIME - STARTTIME)
    The duration in this example should be 10.15?
    Thanks,
    Nate

    Hi NorthrailDrive,
    DUR2HOURS gives the value in decimal hours, not hours:minutes.
    Your answer (in decimal hours) is correct (10.25, or ten and a quarter hours).
    Cell C2 contains the formula you need to calculate a duration:
    =B2-A2
    C2 is formatted as Duration h (hours) m (minutes). You can change the display to show 10:15
    Regards,
    Ian.

  • SOAP creates incorrect duration of an appointment

    Hi Preston,
    I used the GW SOAP in C# to create an appointment: start date = 2010-11-07T00:30:00EST, end date = 2010-11-07T01:30:00EST. The duration is acturally 1 hour, but the appointment created on the GroupWise client shows 2 hours.
    Note: Nov 7, 2010 is the day to change from EST to EDT and we have two 1:30am local time on that day.
    I think the problem is in the end date. C# always converts the end date to 2010-11-07T06:30:00Z and this will be passed into the SOAP call. If the GW client calculates the duration using the GMT time, it will always be 2 hours insead of 1 hour.
    Do you think this is a bug? Is there a workaround for it?
    Is there a way to pass the duration directly into the SOAP call?
    Thanks,
    Johnny

    The GW Client interprets the start and end of
    daylight savings differently than other
    applications. It has special logic that I can't
    duplicate in the SOAP API. I chose to be
    consistent with other applications. I don't have
    a work around for some cases. I'm not sure how
    to get the GW Client to change and still maintain
    backward compatibility.
    Internally, there is not a duration value. There is
    only a start and end time. Allowing you to specify
    a duration value in the schema, would not help your
    case.
    Preston
    >>> On Friday, October 29, 2010 at 10:06 AM, Johnny
    77<[email protected]> wrote:
    > Hi Preston,
    >
    > I used the GW SOAP in C# to create an appointment: start date =
    > 2010‑11‑07T00:30:00EST, end date = 2010‑11‑07T01:30:00EST. The
    duration
    > is acturally 1 hour, but the appointment created on the GroupWise client
    > shows 2 hours.
    >
    > Note: Nov 7, 2010 is the day to change from EST to EDT and we have two
    > 1:30am local time on that day.
    > I think the problem is in the end date. C# always converts the end date
    > to 2010‑11‑07T06:30:00Z and this will be passed into the SOAP call.
    If
    > the GW client calculates the duration using the GMT time, it will always
    > be 2 hours insead of 1 hour.
    >
    > Do you think this is a bug? Is there a workaround for it?
    > Is there a way to pass the duration directly into the SOAP call?
    >
    > Thanks,
    > Johnny

  • Duration Routine or Function

    Hi Everybody,
    does exist a function to calculate a duration between two datestamps (date + time)?
    Or does somebody know where to find a ABAP routine that do that?
    Thanks in advance
    FedeX

    try this coding.
    GET TIME STAMP FIELD w_start_time.
    write :/ w_start_time.
    do 10000 times.
    write :/ 'A'.
    enddo.
    GET TIME STAMP FIELD w_end_time.
    write :/ w_end_time.
    w_fin_time = w_end_time - w_start_time.
    write /: w_fin_time.
    My system gave this output :
    20,060,418,101,921.9050000 (20060418 101921905)
    20,060,418,101,922.0300000 (20060418 101922030)
    difference 0.1250000 (milli seconds)
    <b>refer weblog...
    /people/horst.keller/blog/2004/11/29/abap-geek-8-150-summertime-blues-133

  • Duration Rounding Up

    I have a formula that calculates the duration between two time stamps plus a default value assigned to travel time. The return should be 1h30m but I keep getting the response of a rounded up 2h. Thoughts? Note - this is in Numbers on iPad.

    1-tap the cell (or whole column if its a table of data)
    2-then the little i button in the top right
    3-then tap the header in that window for "Format"
    4-then tap teh blue arrow next to Duration
    5-Now drag the little box in the top to encompass both hours and Minutes
    tap away and you should have it correct now.
    Jason

  • Function module to fill duration

    Hi.
    I have one problem. I defined under date management one new DURATION. Now I calculate this duration according to some dates and want to fill this Duration date type with my calculated value.
    I tried using functions CRM_APPT_MAINTAIN_SINGLE_OW and CRM_APPT_MAINTAIN_MULTI_OW but I'm unable to fill this duration with value. If I try filling field timestamp_from of some DATE TYPE, it works OK. But I can't fill the field duration of DURATION date type.
    Help will be appreciated.

    Hello Robert,
    Instead of coming back and saying "Solved By Myself" you should actually post the solution you used to share with others who may encounter the same issue you had.  You've done this "one liner" on a lot of your posts and it really does not help the community, it just becomes a dead end for anyone else who may have the same / similiar issue.  You had the time and effort to post the question, find it in your heart to post the solution as well.  It benefits the COMMUNITY.
    Thanks,
    Jon

  • Duration of a Treasury Bond Portfolio

    Hi,
    I want to identify the duration of the Bond portfolio (The CFM module is already implemented.) will somebody please guide me by providing the steps of configarations, to calculate the duration of a Bond portfolio.
    Thanks
    GKP

    Hi Gayani,
    you can identify the duration (modified or macaulay) with the logical database (FTI_LDB_TR_POSITIONS). There you will get the duration figures for each bond position. Have a look at transaction SE36 with the above mentioned LDB. There you will find the fields. To realize this you have to set up a query with transaction SQ01 or use a existing report based on this LDB.
    Regards
    Robert

Maybe you are looking for