Time Calculations in a Table

I am creating a new timesheet Which uses a table with a add time/remove time buttons.
The basic table has a Time In row and a Time Out row. In the footer row Itotal each day. That is no problem as i am using the same script I use in other forms.
The problem occurs is when you click the Add Time button and now another instance of the Time In and Time Out rows are added.
How do I now calculate that time and add the 2 together. I can add up to an additional 2 instances. Below is my script for just calculating the basic time for Sunday.
Thanks,
Craig
var vTime1 = Times.TimeIn.in1Sun1.rawValue;
  if (vTime1.length == 4 && vTime2.length == 4) {
var vTime1Minutes = parseInt(vTime1.substring(0, 1))*600 + parseInt(vTime1.substring(1, 2))*60 + parseInt(vTime1.substring(2, 4));
var  vTime2Minutes = parseInt(vTime2.substring(0, 1))*600 + parseInt(vTime2.substring(1, 2))*60 + parseInt(vTime2.substring(2, 4));
this.rawValue = (vTime2Minutes - vTime1Minutes)/60;
var  vTime2= Times.TimeIn.out1Sun1.rawValue;

Hi,
This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the Power Pivot forum
http://social.technet.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlkjpowerpivotforexcel
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support

Similar Messages

  • Calculation operations on table

    Hi all,
    Is there any way to identify calculation operation on column of table in CREATE TABLE statment. the arguments of operation it will take it from other table columns using SQL.
    e.g: x=y+z where y in table A and z in table B
    please help.
    regards,
    Mona

    As William was noting, you can do a calculation form more than one table at the time you create the table. But, those values in your new tbale will not change if the values in table_A and table_B (which were used in the calculation) change later.
    Maybe you were asking about another feature, new for 11g, whch allows you to create a virtual column. It permits you to create a column in a table which is entirely dependent on one or more other columns in the same table. When the values in those dependent coloumn(s) change, the virtual column changes, too. But: a virtual column can be based only on fields in the same table - you cannot reference other tables in the calculation.

  • Execution time calculation issue

    Hi,
    I have a proceudre which update the tables data and it will capture the execution time for each and every table.
    For that i am using below procedure and its giving incorrect values. i.e., its giving end_time<start_time
    PFB code(Line nos 25,26,33,73,7679,80 code for exeution time calculation) and output.
    1 CREATE OR REPLACE PROCEDURE my_proc
    2 IS
    3 CURSOR c
    4 IS
    5 SELECT tablename, TYPE
    6 FROM table_list;
    7
    8 TYPE emp_record IS RECORD (
    9 empkey tab1.pkey%TYPE,
    10 rid ROWID,
    11 ID tab_join.ID%TYPE,
    12 dt tab_join.dt%TYPE
    13 );
    14
    15 TYPE emp_type IS TABLE OF emp_record
    16 INDEX BY BINARY_INTEGER;
    17
    18 v_emp emp_type;
    19
    20 TYPE emp_type_rowid IS TABLE OF ROWID
    21 INDEX BY BINARY_INTEGER;
    22 tab_no Number:=0;
    23 emp_rowid emp_type_rowid;
    24 r_cur sys_refcursor;
    25 v_start_time TIMESTAMP; /** Added for time calculation*/
    26 v_end_time TIMESTAMP; /** Added for time calculation*/
    27 string1 VARCHAR2 (1000) := 'SELECT b.empkey, b.ROWID rid, a.id id, a.dt dt FROM emp_base a,';
    28 string2 VARCHAR2 (1000) := ' b WHERE a.empkey = b.empkey';
    29 rowcnt Number;
    30BEGIN
    31 FOR c1 IN c
    32 LOOP
    33 tab_no:=tab_no+1;
    34 v_start_time := SYSTIMESTAMP; /** Added for time calculation*/
    35 BEGIN
    36 string_d := string1 || c1.tablename || string2;
    37
    38 OPEN r_cur FOR string_d;
    39
    40 LOOP
    41 FETCH r_cur
    42 BULK COLLECT INTO v_emp LIMIT 50000;
    43
    44 IF v_emp.COUNT > 0
    45 THEN
    46 FOR j IN v_emp.FIRST .. v_emp.LAST
    47 LOOP
    48 emp_rowid (j) := v_emp (j).rid;
    49 END LOOP;
    50
    51 upd_string := ' UPDATE ' || c1.tablename || ' SET id = ' || v_emp (1).ID || 'WHERE ROWID = :emp_rowid';
    52 FORALL i IN emp_rowid.FIRST .. emp_rowid.LAST
    53 EXECUTE IMMEDIATE upd_string
    54 USING emp_rowid (i);
    55 rowcnt := rowcnt + emp_rowid.COUNT;
    56 END IF;
    57
    58 EXIT WHEN v_emp.COUNT < 50000;
    59 v_emp.DELETE;
    60 emp_rowid.DELETE;
    61 END LOOP;
    62
    63 v_emp.DELETE;
    64 emp_rowid.DELETE;
    65
    66 CLOSE r_cur;
    67 EXCEPTION
    68 WHEN OTHERS
    69 THEN
    70 DBMS_OUTPUT.put_line (SQLERRM);
    71 END;
    72
    73 v_end_time := SYSTIMESTAMP; /** Added for time calculation*/
    74
    75 INSERT INTO exec_time
    76 VALUES (tab_no||' '||c1.tablename, v_start_time, v_end_time, v_end_time - v_start_time, rowcnt); /** Added for time calculation*/
    77
    78 COMMIT;
    79 v_start_time := NULL; /** Added for time calculation*/
    80 v_end_time := NULL; /** Added for time calculation*/
    81 rowcnt := 0;
    82 END LOOP;
    83END;
    Output :
    TableName: exec_time
    "TABLE_NAME"      "START_TIME"     "END_TIME"      "EXCUTION_TIME"      "NO_OF_RECORDS_PROCESSED"
    TAB7      5/29/2013 10:52:23.000000 AM      5/29/2013 10:52:24.000000 AM      +00 00:00:00.521707      773
    TAB5      5/29/2013 10:52:18.000000 AM      5/29/2013 10:52:15.000000 AM      -00 00:00:03.381468      56525
    TAB6      5/29/2013 10:52:15.000000 AM      5/29/2013 10:52:23.000000 AM      +00 00:00:08.624420      49078
    TAB2      5/29/2013 10:51:54.000000 AM      5/29/2013 10:51:42.000000 AM      -00 00:00:11.932558      529
    TAB4      5/29/2013 10:51:47.000000 AM      5/29/2013 10:52:18.000000 AM      +00 00:00:31.208966      308670
    TAB1      5/29/2013 10:51:45.000000 AM      5/29/2013 10:51:54.000000 AM      +00 00:00:09.124238      65921
    TAB3      5/29/2013 10:51:42.000000 AM      5/29/2013 10:51:47.000000 AM      +00 00:00:04.502432      12118
    Issue: I am getting execution time in negitive values because end_time<start_time coming.
    Please suggest me how to resolve this.
    Thanks.

    Welcome to the forum!!
    Please read {message:id=9360002} from the FAQ to know the list of details (WHAT and HOW) you need to specify when asking a question.
    I primarily hate 3 things in your code
    1. The way you have used BULK update which is totally unnecessary
    2. COMMIT inside LOOP
    3. The use of WHEN OTHERS exception.
    Your code can be simplified like this
    create or replace procedure my_proc
    is
       v_start_time timestamp;
       v_end_time   timestamp;
       v_rowcnt     integer;
    begin
       for c1 in (
                     select rownum tab_no
                          , tablename
                          , type
                       from table_list
       loop
          sql_string := q'[
                                  merge into #tablename# a
                                  using (
                                          select id, dt
                                            from emp_base
                                        ) b
                                     on (
                                          a.empkey = b.empkey
                                    when matched then
                                        update set a.id = b.id;
          sql_string := replace(sql_string, '#tablename#', c1.tablename);
          v_start_time := systimestamp;
          execute immediate sql_string;
          v_end_time   := systimestamp;
          v_rowcnt     := sql%rowcount;
          insert into exec_time
               values
                    c1.tab_no || ' ' || c1.tablename
                  , v_start_time
                  , v_end_time
                  , v_end_time - v_start_time
                  , v_rowcnt
       end loop;
       commit;
    end; In the INSERT statement on the table EXEC_TIME try to include the column list.
    NOTE: The above code is untested.

  • To store time only in the table and get it to the report in Apex

    Hi,
    I am very very new to Apex.
    I get a txt file with around 57 columns(comma seperated). In apex we import this and insert it into a database table (csv into table) and then generate a reports out of this table using procedure/packages. we have different fields in this extract which gives different dates and times ( thats right dates and time comes seperate in seperate columns). I would like to insert this dates and times seperately into the table. thats is, getting a table as an exact image of the extract we receive.What data type do I choose to save just the time.
    I can only see 'date' data type where I can have both date and time. But can't find anything just for time.
    The main use of this time(s) saved seperately in the table is , I can then easily display it in reports.
    The report the users want has got fields like transport start time, duty start time etc..
    If you can't save time seperately in the database table, then can somebody suggest a way of saving it in table (in the method available)and then getting the time seperated out into the report.
    Currently the users use macro on excel to get this reports and formatting a cell to 'time' is simple.
    Any suggestions welcome.
    Regards
    Liza

    Varad,
    I have been trying to get this date-time issue in different areas in my application.
    From csv to table its working (once I got dates in the extract adjusted to '02mar2009' format).
    Now I have manipulation to do on this datetime.
    Say I have datetime1, to get datetime2 I have to get datetime1 and reduce some minutes.
    I got the time part into l_temp after reducing the minutes.
    datetime2 :=to_date(sysdate || l_temp,'dd-mon-yyyy hh24mi');
    It gives an error saying 'literals doesn't match format string' (both at sql command and PL/SQL in apex
    I even tried datetime2 :=to_date(to_char(sysdate,'dd-mon-yyyy') || l_temp,'dd-mon-yyyy hh24mi');
    gets the same error in apex but this works fine in sql command.
    But if I put datetime2 :=to_date('02mar09' || l_temp,'dd-mon-yyyy hh24mi');
    Do you know why? Can you suggest something?
    Obviously, I can't hard code it. I have read the date from table1 and write it to table 2 with after this manipulation.
    Any suggestion?
    regards
    Liza
    Edited by: liza on Mar 3, 2009 5:13 PM

  • Calculation in a table

    Hi All- I've the following table "Count"
    Year        Period               Pd Start Dt    Pd End Dt    Count1         Count2      Count 3
    2012    Period 05, 2012    25-APR-12    29-MAY-12    10779455    7557757      0
    2012    Period 06, 2012    30-MAY-12    26-JUN-12    11056981    7750255       0
    2012    Period 07, 2012    27-JUN-12    24-JUL-12    11328596    7940012        0
    2012    Period 08, 2012    25-JUL-12    28-AUG-12    11678538    8182974       0
    2012    Period 09, 2012    29-AUG-12    25-SEP-12    11951574    8372835      0
    2012    Period 10, 2012    26-SEP-12    23-OCT-12    12228481    8567254       0
    2012    Period 11, 2012    24-OCT-12    27-NOV-12    12543681    8789947       0
    2012    Period 12, 2012    28-NOV-12    25-DEC-12    12791420    8964870      0 
    Now I want to do the following calculation on the table Count3= (Count1/Count2)*100. Can someone please help me with the SQL of this? I know this is pretty straight forward but any help is greatly appreciated. Thanks again.

    Hi,
    It sounds like you want this:
    UPDATE  cnt    -- COUNT is not a good table name
    SET     count3  = (count1 / count2) * 100
    or, if you don't want to actually change the table:
    SELECT  year, period, pd_start_dt, pd_end_dt, count1, count2
    ,       (count1 / count2) * 100    AS count3
    FROM    cnt     -- COUNT is not a good table name
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    If you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002#9362002

  • How is Processing time calculated in Simulation

    Hi,
    How is processing time calculated for every simulation-relevant object?
    say for example,
    i have 2 objects of person type (p1 and p1)
    4 human tasks (T1, T2, T3, T4)
    T1 assigned to p1, processing time 2hrs
    T2 assigned to p1, processing time 2hrs
    T3 assigned to p2, processing time 2hrs
    T4 assigned to p2, processing time 2hrs
    start --&gt; T1(p1) --&gt; T2(p1) --&gt; T3(p2) --&gt; T4(p2) --&gt; end
    Have not set any other simualtion parameters. now,
    * Duration for simulation is set to 6hrs,
    T1, T2, and T3 are getting processes once, but start event is getting processed twice
    # Why is start event getting processed second time?
    # Will this take any processing time..
    * Duration for simulation set to 7hrs,
    start event and T1 gets processed 2 times, T2 and T3 once..
    and the total processing time becomes *8hrs*..
    # At wht point of time does the second processing of T1 start.
    # If it is not after after the completion of one full process cycle, in this case, why not the second processing start at the end # of 2nd hour, or 4th hour.
    Thanks,
    Vishnupriya

    Hi Vishnupriya,
    "Why is start event getting processed second time?"Can you check the "Frequency" attribute of your start event? There you can specify how often the process will be triggered.
    "At wht point of time does the second processing of T1 start."You should be able to check it in the Processes (det.). It provides an overview regarding the process instances started during the simulation run. Furthermore you can check the Events (det.) category.
    Best regards,
    Danilo

  • Add time field in database table

    Hi Gurus,
    I am trying to add a time field in database table. I know i can add it by using append structure.
    but my problem is when records r creating in database table, the time field also populate with respective system time automatically. i think i need to use events but i have no idea how to use.
    is there any other method available?
    is there any system field for time stamp as date + time?
    Regards
    Giri

    Rob,
    its not updating by table maintainance generator.
    I want to add Time field in table ESTDH. 
    when a new record updated while report version generated the time field also populate with system field.
    is it possible?
    can anybody help me?
    Regards
    Giri

  • Modelling Time Dimension with Fact Table containing Start Date and End Date

    Hi Gurus,
    I have a time dimension with Year till Date. I have a fact table which consists of Start Date, End Date, Person ID, Department ID.
    How do i design Time dimension with fact table the below scenario
    In the dashboard i have start Month and End month as prompts.
    In the report i need to display Count(Person ID) > Start Date and < End Date along the trend.
    For instance, i have selected Jan-2009 as start date and Apr-2009 as End Date, then i need to display Count(Person ID) of Jan-2009, Feb2009, Mar-2009 andApr-2009.
    I Can not connect Time dimension with only Start Date or only with End Date to get the trend along the months.
    Please advice on the issue which i am having.

    Hi,
    Thanks for the response, Infact i tried using Complex join in physical layer. I have considered Time table joined with Fact table, and used >= and took and alias of the Time table and joined fact table using <=. When coming to BMM, i am not knowing how do i design this as if i merge the both the time dimensiona and its alias into single table, values will not be correct and if i make them as seperate columns. i can not show the trend as both are different columns.
    Can you please let know where i am going wrong.
    Thanks

  • Ess Leave  Request -Change in Time calculation without changing work schedu

    Hi All,
    We are implementing a ESS Leave Request in EP6 with backend HR ECC5.0.
    The time calculation is taken  from the Work schedule rule in
    HR backend which is 24*7.
    For example if the leave taken is for 2 days-systems calculates as 24*2=48 hrs
    but in actual the requirement is to calculate 2*8 =16 hrs without changing
    the Work Schedule in 2001 infotype in HR Backend.
    Can we do this change through
    1.Validation in portal itself
    2.Changing the RFC PT_ARQ_REQUEST_CHECK
    3.Changing the Absence Types
    Regards
    Anand.

    Hello,
    Please use:
    programming
    but without the spaces before and after } and {
    Testing:
    programming
    regards
    Rick Bakker
    Hanabi Technology

  • Real time update in Oracle Table

    Hi Friends,
    I have a new requirement (challenging) and i need your inputs to proceed further.
    User is expecting an real time update in Oracle Table.
    Example:
    I have an Oracle (10g) table DDSX-CALENDAR table. whenever a record(new) gets inserted into this table, i need to take this record and update the other oracle table (10g) existing in a different environment (schema and server).
    Please let me your inputs about handling this requirement.
    Thanks for your time.
    Regards,
    Diwakar Dayalan

    Thanks Prasath.
    I beleive for setting up the DBlink the user needs to have DBA role.
    How do we know the data has been inserted into the source, do i need to use a trigger for that ?
    In which way i can use the DB link inside a trigger to update the values in the target table.
    Example
    My source tables is
    DDSX_STR_BANK
    Store Number Bank Name Bank Account Number
    0001 BOA 111111111111 (assume previous value is 222222222222 )
    0002 BOA 222222222222 (assume previous value is 111111111111).
    Now two store numbers have got its bank account number updated in the source and the value is inserted, Now my requirement is once the value is inserted in the source, i need to update bank account number in SSDX_STR_BANK table in a different server and schema.
    SSDX_STR_BANK
    Store Number Bank Account Number
    0001 222222222222
    0002 111111111111
    Update the bank account numbers in Sync with the DDSX_STR_BANK.
    Please guide me how to proceed with this requirement.
    Thanks,
    Divakar

  • Scout: Too much time calculating dirty regions

    Hi All,
    Frist of all, sorry for my English.
    I have a problem with my AIR App, I'm developing for Android and iOS. In iOS works perfectly but on Android the performance is poor.
    I checked with Scout and this is what i see:
    I don't understand why it spends so much time calculating dirty regions but I didn't change anything on the DisplayList.
    Edit: AS you can see in the screen the frames are 13 but in the next frames is over 200 frames and that repeats.
    Can someone tell me how to interpret this results?
    Thanks a lot.
    Goratz
    Mensaje editado por: goratz

    The feature you are referring to exists in Logic but not in GarageBand (yet?). It is called the Marquee Tool that lets you drag a selection, and when hitting the delete key, that section of the Region(s) will be deleted, and the remaining part of the Region on the right will be moved to the left to close the gap (if you you have set the Drag Mode to "Shuffle L").
    Hope that helps
    Edgar Rothermich
    http://DingDingMusic.com/Manuals/
    'I may receive some form of compensation, financial or otherwise, from my recommendation or link.'

  • Warning Time calculation "Before Aggregation" is obsolete

    Hi,
    Recently in our project we have upgraded BW 3.0B to BI7.
    After upgrade to BI7,  when we run some of the reports we are getting a warning message as below -
    Warning Time calculation "Before Aggregation" is obsolete.
    Pls refer to the attachment.
    Any of our satyam colleagues encounter this warning, if so what was the solution you applied.
    Note : I found some notes in Forum like saying use ' Exception Aggregation' for the Before Aggregation.. etc etc., but my problem is in our project thre are many CKFs are there which are using 'Before Aggregation'.
    Please let me know if you have any other alternatives.
    Thanks !!!!!!!!!

    Hi,
    Try SAP notes 935903.
    Symptom
    Calculated Key Figures "Existance Indicator" with aggregation behaviour "Before Aggregation" will get now with NW 2004s warning popup "Time of calculation 'Before Aggregation' is obsolete" during execution.
    this may be helpful.
    thanks,
    JituK

  • Time Calculation Shell dimension is slow compared to hardcoded measure?

    Hi,
    I have a measuregroup with 200m+ rows with about 20 measures (sums). I've created a shell dimension to hold my time calculation members such as mtd, qtd, ytd, etc. My problem is that it performs REALLY poorly when using the time calculation dimension.
     My script looks like this:
    SCOPE
    Measuregroupmeasures("MyMeasureGroup");
    SCOPE
    [Time Calculation].[Calculation].&[None];
    THIS =
    [Measures].CurrentMember;
    END SCOPE;
    SCOPE
    [Time Calculation].[Calculation].&[MTD];
    THIS =
    Aggregate
    [Time Calculation].[Calculation].&[None]
    MTD([Date].[Calendar (YQMD)].CurrentMember)
    END SCOPE;
    SCOPE
    [Time Calculation].[Calculation].&[QTD];
    THIS =
    Aggregate
    [Time Calculation].[Calculation].&[None]
    QTD([Date].[Calendar (YQMD)].CurrentMember)
    END SCOPE;
    SCOPE
    [Time Calculation].[Calculation].&[YTD];
    THIS =
    Aggregate
    [Time Calculation].[Calculation].&[None]
    YTD([Date].[Calendar (YQMD)].CurrentMember)
    END SCOPE;
    END SCOPE;
    When I use my Calendar hierarchy and time calculation dimension as a background selection it takes forever. It never returns anything. A profiler trace shows that it's just pushing 1 and 21 events (cache data).
    If I create the following measure:
    CREATE
    MEMBER CURRENTCUBE.[Measures].[TestMTD] AS
    SUM(MTD([Date].[Calendar (YQMD)].CurrentMember), [Measures].[MyMeasure]),
    VISIBLE = 1 ;
    it works just fine but the whole point here is I want to avoid creating new measure for every time calculation.
    The measuregroup has been partitioned by month and I've set each partition slice to the corresponding month in the calendar hierarchy.
    Why doesn't my script perform - please advice :)
    Thanks.

    Hi Mortenbpost,
    According to your description, the issue was solved by change Aggregate() function to Sum() function, now you want to know why it behaves like that, right?
    In Aggregate function, if a numeric expression is not provided, this function aggregates each measure within the current query context by using the default aggregation operator that is specified for each measure. Here is a thread which discuss difference
    between AGGREGATE() and SUM()https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ef4b2555-45f2-4871-9137-a12a637ce2f5/whats-the-difference-between-aggregate-and-sum?forum=sqlanalysisservices
    Besides, you can use SQL profiler to monitor what's the difference between using AGGREGATE() and using SUM().
    Regards,
    Charlie Liao
    TechNet Community Support

  • Characteristic 0PROFIT_CTR: Time-dependent Master Data Table '/BI0/QPROFIT_

    Hello All,
    I want to release a infoObject 0PROFIT_CTR to Prod. But after releasing the TR it errors with the following messages:
    Characteristic 0PROFIT_CTR: Time-dependent Master Data Table '/BI0/QPROFIT_CTR' not buffered
    Characteristic 0PROFIT_CTR: Time-dependent Text Table '/BI0/TPROFIT_CTR' not buffered
    I went into these tables and also have set the buffering to ON and made them Fully buffered (Checked).
    But even then it gives me same error.
    Please help.
    Regards,
    KP

    Hi Harika,
    You are right, you will have to use SE14 in production system, just check that whether you have authorization to use it or not. If you don't have authorization then you can check with Basis team.
    You can execute SE14, then give table name and in the lower part of the screen Click on the option Save and adjust, and activate the table. Once this step is done you can re-import your request.
    Make sure that you do not delete data.
    Regards,
    Durgesh.

  • I want to programmtically change the font of one cell at a time in a LabVIEW table

    I want to programmtically change the font of one cell at a time in a LabVIEW table. How would I do this. I know it is possible to change an individual cells font properties on the front panel but I want to do it via the diagram (code).

    You are able to change each cell's background and foreground (text) color, but it seems the ability to specify font information with properties is lacking in both 6.1 and 7.0.
    Daniel L. Press
    PrimeTest Corp.
    www.primetest.com

Maybe you are looking for