Cumulative Time Calculation (in: DateTime type A/ DateTime type B, out: Numeric type C/ Numeric type D)

Calculates the elapsed time from the specified two date times and adds it as cumulative time to the data item

    A. Select DATETIME DATA for StartData selectDatetimeRequired
    B. Select DATETIME DATA for EndData selectDatetimeRequired
    C. Select NUMERIC DATA for Elapsed Time (h) (update)Data selectNumericRequired
    D. Select NUMERIC DATA for Arrival Count (update)Data selectNumericRequired
    -variable namevariable label
    Aconf_DataIdASelect DATETIME DATA for Start
    Bconf_DataIdBSelect DATETIME DATA for End
    Cconf_DataIdCSelect NUMERIC DATA for Elapsed Time (h) (update)
    Dconf_DataIdDSelect NUMERIC DATA for Arrival Count (update)
    // Lost Time Calculator (ver. 20170523)
    // (c) 2017, Questetra, Inc. (the MIT License)
    
    //// == 自動工程コンフィグの参照 / Config Retrieving ==
    var dataIdA = configs.get( "conf_DataIdA" );
    var dataIdB = configs.get( "conf_DataIdB" );
    var dataIdC = configs.get( "conf_DataIdC" );
    var dataIdD = configs.get( "conf_DataIdD" );
    
    //// == ワークフローデータの参照 / Data Retrieving ==
    var loopCount = data.get( dataIdD ) - 0; // Java to JavaScript Number
    var lostTime  = data.get( dataIdC ) - 0; // Java to JavaScript Number
    
    var startTime = data.get( dataIdA ); 
    var endTime   = data.get( dataIdB ); 
    // com.questetra.bpms.util.AddableTimestamp
    
    //// == 演算 / Calculating ==
    loopCount = loopCount + 1;
    var intervalMilliSec = endTime.getTime() - startTime.getTime();
    var intervalHour = Math.ceil( intervalMilliSec / 10 / 3600 ) / 100;
    lostTime = lostTime + intervalHour;
    
    //// == ワークフローデータへの代入 / Data Updating ==
    retVal.put( dataIdD, java.math.BigDecimal( loopCount ) );
    retVal.put( dataIdC, java.math.BigDecimal( lostTime ) );
    

    • A’: Time stored in the Data Item that is selected at config A
    • B’: Time stored in the Data Item that is selected at config B
    • The cumulative elapsed time from A’ to B’ (the second decimal place) is added to the value of the data item selected at C
    • The number of times cumulated is stored in the data item selected at D