Subtotals using Timestamps

I have a report that details, by date and employee, the duration of travel for any number of journeys.
In the database this duration is held as a number of seconds, and is converted to HH:mm:ss in the RPD or within the report itself.
What I need to do is, after each day, show a subtotal for the total duration of the journeys made.
For example:
Emp No /     Emp Name     / Date / Job No / Journey Duration
123 / Smith /      03/05/2011 /     765 /     00:52:00
123 /     Smith /      03/05/2011 /     766 /     00:00:00
123 /     Smith /      03/05/2011 /     777 /     01:03:00
          Total 03/05/2011           01:55:00
456 / Jones / 03/05/2011 / 987 / 01:56:23
456 / Jones / 03/05/2011 / 988 / 00:12:02
          Total 03/05/2011           02:08:25
So far I’ve been unable to do this totalling of timestamps. Obviously I could total the seconds up, and provide a subtotal of that - but it doesn't seem possible to format the subtotal to HH:mm:ss afterwards.
Is this possible? I can download to Excel and do this straight away - but I want to do it within OBIEE.

Thanks for the reply Robert.
No the problem is that it doesn't seem possible to perform arithmetic on timestamps (or dates)... just numerics. If I work out the result as seconds, then where would you apply the formatting? If you apply a formula to convert seconds to HH:MM:SS then that's done before the summation - which fails. If you apply column formatting, then there is no option applicable (because its numeric then you get the choice only to say how many decimal places etc)... or so it seems, I'm hoping you can put me right! :)
Remember, as well, that this is a subtotal... so formatting can't be applied separately to the rest of the column.

Similar Messages

  • ALV subtotals using methods

    Hi
    Please provide me sample code for subtotals using methods.
    The code is
    DATA: ls_sort TYPE lvc_s_sort.
    ls_sort-spos = '1' .
    ls_sort-fieldname = 'BWART'.
    ls_sort-up = 'X'.
    ls_sort-subtot = 'X'.
    *ls_sort-group = 'UL'.
    APPEND ls_sort TO p_gt_sort.
    endform
    but it is not working
    Please help me

    Hi,
    this is how you should do...
    CLASS lcl_event_handler DEFINITION DEFERRED.
    DATA: dg_events_receiver TYPE REF
                                TO lcl_event_handler.  "event receiver
    *       CLASS lcl_event_handler DEFINITION
    *       For Event handling                                             *
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
           subtotal_text        FOR EVENT subtotal_text
                             OF cl_gui_alv_grid
                             IMPORTING es_subtottxt_info
                                       ep_subtot_line
                                       e_event_data.
    ENDCLASS.                    "VERIFY_EVENT_HANDLER DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    *       Implementation of event handler method                        *
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD subtotal_text.
        PERFORM d0100_event_subtotal_text USING es_subtottxt_info
                                                ep_subtot_line
                                                e_event_data.
      ENDMETHOD.                    "subtotal_text
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    *--set event handler
      PERFORM set_event_handler.
      CALL METHOD dg_grid->set_table_for_first_display
        EXPORTING
          is_layout                     = ds_layout
        CHANGING
          it_outtab                     = <fs_f>
          it_fieldcatalog               = dt_alv_cat
          it_sort                       = dt_sort
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE i000 WITH
             'Error in calling SET_TABLE_FOR_FIRST_DISPLAY'(026).
      ENDIF.
    *&      Form  set_event_handler
    *       event handler
    *  -->  p1        text
    *  <--  p2        text
    FORM set_event_handler .
      CREATE OBJECT dg_events_receiver.
      SET HANDLER dg_events_receiver->subtotal_text
                  FOR dg_grid.
    ENDFORM.                    " set_event_handler
    *&      Form  d0100_event_subtotal_text
    *       To handle subtotal text event
    *      -->P_ES_SUBTOTTXT_INFO  text
    *      -->P_EP_SUBTOT_LINE  text
    *      -->P_E_EVENT_DATA  text
    FORM d0100_event_subtotal_text  USING
                            p_es_subtottxt_info TYPE lvc_s_stxt
                           p_ep_subtot_line TYPE REF TO data
                           p_e_event_data TYPE REF TO cl_alv_event_data .
      FIELD-SYMBOLS: <fs> TYPE ANY.
      ASSIGN p_e_event_data->m_data->* TO <fs>.
      <fs> = 'TOTAL'(027).
    ENDFORM.                    " d0100_event_subtotal_text
    Regards
    vijay

  • Problem in following the webblog "Using TimeStamps: BSP Extensions"

    I try to follow the webblog "Using TimeStamps: BSP Extensions for a TimeStamp UI."
    However, after I have created the method 'RESOLVE_MODEL_BINDING' and compiled it, it shows me an error message
    <b>'Method "ADD_TO_CHECK_TABLE" is unknown or PROTECTED or PRIVATE.'</b>
    This is some part of that code.
      model = m_page_context->get_model( model_name ).
      name = model->get_attribute_name( attribute_path = value_path ).
      valuelow = model->get_attribute( attribute_path = value_path ).
      IF id IS INITIAL.
        id = name.
      ENDIF.
      IF disabled IS INITIAL.
        bspmodel ?= model.
        bspmodel->add_to_check_table( control_id = name ).
      ENDIF.

    I defined the bspmodel above the if block like the tutorial code.
    DATA: model             TYPE REF TO if_bsp_model_binding,
          model_name        TYPE string,
          metadata          TYPE REF TO if_bsp_metadata_simple,
          metadata_base     TYPE REF TO if_bsp_metadata,
          value_path        TYPE string,
          is_valid          TYPE i,
          error_value       TYPE string,
          bspmodel          TYPE REF TO if_bsp_model.
    I further looked into the interface <b>if_bsp_model</b> in my system. It doesn't include any interface, and only five methods were found:
    1) INIT
    2) GET_BINDING_INTERFACE
    3) GET_ERRORS
    4) INSTANTIATE
    5) RESET_ERRORS

  • Using Timestamp Object with day light saving time

    Hi,
    I am getting problem while using timestamp object with daylight saving time.
    I am in 'Europe/London' time zone.
    The summer time for this year starts on 30 March(last sunday) at 0200 hours.
    For hour 30/03/2003 01:00, I created a date object using SimpleDateFormat and then created the timestamp object using the longvalue got from dateObject.getTime();
    On printing the timestampObject.toString() it displays
    30/03/2003 00:00 BST.
    It seems that timestamp object uses the system timezone and I want it to be in GMT.
    Could you please tell me how can I get GMT time from timestamp object.
    When creating timestamp object from date

    To translate Date/Timestamp objects in a controlled way use DateFormat objects. When you create a DataFormat object you can specify a Locale object which stipulates timezone information.

  • Using Timestamp - newbie

    Hi,
    I've got a question on how to use TimeStamp?...which timestamp class/method to use?..etc,etc...
    I'm using JDeveloper with Oracle 8i and it's a distributed database environment.
    I've got a single UI for order entry and Ineedto capture the timestamp from the UI and put it into the tables using JDBC - is there such a sample available somewhere or can anyone help me, please?....this is for an assignment and it's due wednesday (9th Oct)- australian time...& this is the only part of it that I havent been able to figure out yet thanks!!...appreciate any help..

    Hi,
    thanks very much for that - I did go thru the forums and there was stuff on timestamp but not on what I needed to do - I managed to get it going using oracle's 'to_date' function so it's ok now....took me all afternoon but I finally got it happening (only in my li'l trial date table that I made for it - but hey at least it works) .. now to integrate into the actual assignment!!....thanks heaps, ciao,

  • Playback skips in archive using timestamp

    We are using a the flash player to play back archives from live streams. We are using timestamps so that questions during the stream can match the stream playback.
    The streams are saved in full with no problems but in playback in the Flash player we are experiencing skips at the exact same points.
    Example:
    One archived stream of 30 questions experiences 2 parts where it freezes and skips. I read here that it might have to do with "silent" parts not being saved with teh timestamps.
    http://code.google.com/p/red5/issues/detail?id=15
    Has anyone experienced similar issues?

    3 months have gone by, and you still haven't gotten a response... Adobe Software is no better than a toothpick made in China. They want your money, that's it!

  • How to get  generic delta using timestamp field

    Hi All,
    i have created a generic datasource using tables vbrp,vbrk.mara,marc,knvv.. to get the sales data for planning.Here i have document created date and time.So i'm concatinating these 2 date and time fields into timestamp which is of format yyyymmddhhmmss.Finally i'm using this timestamp to extract data .
    So is it the right way to pull the data using timestamp and what is the timezone i need to specify as the servers are in india only.
    or any other way to proceed.
    Thanks
    Rao.

    Hi Rao,
    Delta based on timestamp based on generic datasource only works if any one of the tables contains timestamp field(not time and date fields separately).
    I dont think by combining date & time fields will give you correct results.
    Regarding time zone: Use SAP system time zone.
    Srini

  • How to calculate the subtotals using reuse_alv_grid_display_lvc

    Hi folks,
    How to get the subtotals of shipped quantity monthly wise using reuse_alv_grid_display_lvc.
    Thanks in Advance
    Rao

    Hi,
    As per the standard SAP, it is not possible to display the subtotal in a different field. The solution is remove the subtotal field from the internal table.
    In the slis_t_sortinfo_alv table pass the kunnr field with subtot = 'X'.
    I hope this will solve your query.
    Reward all useful answers.
    Thank you.

  • How to use timestamp column in a xmltable function?

    i have a relational view over a xml table and in the view definition i use a virtual XMLTable. my problem is the timestamp value in the xml is in the format like '2001-12-17T17:30:47Z". therefore the view is running into problems. how do i do to_date() kind of function in a XMLTable definition? Thanks.
    XMLTable(
    COLUMNS name VARCHAR2(6) PATH '@ename',
    id NUMBER PATH '@empno'
    time TIMESTAMP PATH '/order/timestamp'

    Export with timestamp check?

  • Using Timestamp [TS] in the output file name

    Hello Everyone,
    i am trying to get the timestamp into the output file generated by the store file atom. Since my Outbound channel is void i thought i could use:
    [TS]
    or
    [yyyy][mm][dd][hour][min][sec]
    My File Specification is: C:\Temp\Out\blabla[TS].xml and unfortunatelythe outputfile are named: blabla[TS].xml
    What am I doing wrong? Can i not use those placeholders in an atom?
    Help is greatly appreciated
    Best regards
    Simon

    Hi Simon,
    Now I see, you're trying to maintain the timestamp in the SLD FILO section and not in a store file atom of an integration scenario.
    In this case, please check the following help document:
    filePattern
    To define the outbound file pattern, define the directory and the file specification. Enter the full path. The integration framework supports Microsoft Windows UNC (Universal Naming Convention) names. The directory you enter must exist in the file system. The user for directory access must have the necessary rights in the file system.
    You can use the following special characters and variables:
    Character/
    Variable
    Description
    To introduce  numbering in the file directory use ?.
    If you enter  for example data????.xml, the integration framework creates an outbound file called data0000.xml, if the directory is empty. If a file, following this naming  convention, already exists in the outbound directory, the next generated file  name is data<last  number>+1.xml. If data0000.xml already exists in the directory, the next file in the directory  is data0001.xml.
    [vbiu]
    This is a placeholder for a value you can  define in scenario package processing. If you use the value, add the b1im_filename attribute directly in the outbound payload.
    <xsl:template  name="transform">
          <xsl:attribute  name="b1im_filename">myName</xsl:attribute>
    </xsl:template>  
    [TS]
    To add a  timestamp to the file name, use the variable. This gives you another  possibility to define unique file names.
    [yyyy]
    Adds the  current year in four digits to the file name
    [yy]
    Adds the  current year in two digits to the file name
    [mm]
    Adds the  current month to the file name
    [dd]
    Adds the  current day to the file name
    [hour]
    Adds the  current hour to the file name
    [min]
    Adds the  current minute to the file name
    [sec]
    Adds the  current second to the file name
    You can also combine the variables. For example file[TS]??.[hour][min].txt
    Here is a screenshot of my SLD FILO definition and from the result:
    Best regards
    Bastian
    P.S.: just in case you need to define a filename in the integration step for the store file atom, here is a screenshot:

  • Dealy in query when i use timestamp

    Hello all
    I have a query like
    " select * from table where create_date > (select max(update) from tableb) )
    The above query is taking a long long time.
    Createdate and update are timestamps
    So i have tried the below query
    " select * from table where create_date > SYSDATE"
    this is pret quick. So i figured out that the inner query is causing the problem. So i have rewritten it using a join like
    select * from (
    (select col1, col2, createdate from table) a, (select max(update) from tableb) b
    where a.createdate>b.update).
    Even this is taking a long time.
    Can somebod please help me how i can tune this query....

    Read this post:
    When your query takes too long ...

  • Problem in using Timestamp from java.sql.*

    AOA
    i have declared a variable
    private Timestamp entryDate = new Timestamp(8);while using it in my application. it inserts similar time stamp in database , like
    01/01/1970 5:00:00 AM
    How to get current time from it and how to insert it in databse.

    AOA
    i have declared a variable
    private Timestamp entryDate = new Timestamp(8);
    Why? What does that 8 mean to you? Did you read the docs to see what it means to Timestamp?
    >
    while using it in my application. it inserts similar
    time stamp in database , like
    01/01/1970 5:00:00 AM
    How to get current time from it and how to insert it
    in databse.Did you read the docs for Timestamp? There's a constructor and/or a set method that takes a Date or a number of millis. You can get the current time in millis with System.currentTimeMillis. (I think that's the method name. Look at System's docs.)
    As far as inserting it, you'll do something like this: TimeStamp ts = ...;
    Connection con = DriverManager.getConection(...);
    PreparedStatement ps = con.prepareStatement("insert into foo (bar) values (?)");
    ps.setTimestamp(1, ts);
    ps.executeUpdate(); Google for jdbc tutorial for more details.

  • How to use timestamp based dynamic message selector?

    Is it possible with message selector to issue query like statement that
    weill fetch any messages that have header timestamp older than "now" + 3 hrs.
    In SQL you would say something like:
    where timestamp <= sysdate + (180/1440)
    Please let ne know.
    Thank you,
    Edmon

    hi edmon,
    to my knowledge dynamically evalutaed expressions like this are not supported by any of the JMS vendors. messageselectors are in SQL92 format and the only dynamic part in them is the contents of the message properties and headers.
    So, you're out of luck with what you want to do (e.g., remove expired messages from a destination when they havent' been consumed within a time threshold??) but i could see two possible solutions:
    1) You could use time-to-live (TTL) on the sender side. Messages that are on the destination beyond their TTL would be placed onto a dead message queue (DMQ) from where you could consume them for further processing. DMQ is not a standard-JMS feature but supported by a few vendorrs (e.g., JBoss, ArjunaMS).
    2) You could use Message-driven Services (MDS) for more elaborate server-side message processing. MDS has been pioneered by ArjunaMS but is also available with a few other JMS vendors.
    Hope that helps!
    Kind regards,
    Thomas.

  • Crash using Timestamps

    Hi,
    I have (at last!) a simple program that accesses a simple DB. I have one table that contains a column of type TIMESTAMP.
    I want to use this timestamp eventually to select a range of data (perhaps using between or something like that). But to test my program I have first just a simple query to select the timestamp field:
    Stmt->setSQL("SELECT dzupd FROM erec_t");
    Works fine. However I now want to select data with a particular timestamp. So I am trying:
    Timestamp tsStart;
    tsStart.fromText ("01/04/06 00:00:00", "DD/MM/YY HH24:MI:SS", "" , env);
    Now, without doing anything else with the timestamp, the program runs as before, outputs all the data, and then crashes. The information I have seems to indicate a problem with the oraclient10.dll:
    AppName: oracle2.exe     AppVer: 0.0.0.0     ModName: oraclient10.dll
    ModVer: 10.2.0.1     Offset: 000ad0f7
    I am using Oracle 10g on Windows XP.
    Any advice would be much appreciated.
    Many thanks.

    Thanks for the tip.
    I will need to study the link properly, but creating the environment is first thing I do and terminating it is the last.
    The code is very simple and looks like this:
    // Oracle2.cpp : Defines the entry point for the console application.
    #include "stdafx.h"
    using namespace oracle::occi;
    using namespace std;
    int tmain(int argc, TCHAR* argv[])
    //create environment and connection
    Environment* env = Environment::createEnvironment();
    cout << "Environment created" << endl;
    Connection* conn=env->createConnection("tester","tdb","testdb");
    //3rd parameter is db name/TNS alias
    cout << "Connection made" << endl;
    // build SELECT statement
    Statement* Stmt = conn->createStatement();
    Stmt->setSQL("SELECT dzupd FROM erec_t");
    Timestamp tsStart;
    tsStart.fromText("01/04/06 00:00:00", "DD/MM/YY HH24:MI:SS", "" , env);
    ResultSet *rs = Stmt->executeQuery();
    while (rs->next())
         Timestamp st = rs->getTimestamp(1);
         cout << "\t\t" << st.toText("dd/mm/yyyy hh:mi:ss",1) << endl;
    Stmt->closeResultSet(rs);//to free resources
    conn->terminateStatement(Stmt);
    //logoff and terminate connection
    env->terminateConnection(conn);
    cout << "Connection terminated" << endl;
    //terminate Environment by calling static method
    // Environment::terminateEnvironment(env);
    cout << "Environment terminated" << endl;
         return 0;
    I think it is all done within the correct scope but I will study it more closely.
    Thanks for the tip.
    Tristan

  • How to add subtotals using categories

    Hello,
    I’m using categories and in two of my columns I’ve added a SUBTOTAL from  the category cell dropdown menu; so far so good.
    Now I need to add the two subtotal cells across the row to get a Total, and find that the SUM function doesn’t work the same as in a non-category row.  In a non-category row I can select two cells then drag the SUM function to a ‘tally’ cell and voila I have a total. But when I try this with the category > subtotal cells , nothing happens.
    Any suggestions?
    Thanks.
    Ramone

    Hi Ramone,
    Categories are essentially a way of viewing the data on a table. While you can  calculate and display (in the category rows) several numerical quantities associated with each category, the results of these calculations are 'for display only', and to my understanding, can't be used in further calculations.
    Outside the category rows, you may be able to accomplish what you want using SUMIF, SUMIFS and similar functions to create the subtotals, then add those two in the usual manner.
    Regards,
    Barry

Maybe you are looking for