Min/Max for the calculation of depreciation

Hey guys, I'm looking to find a curve of free vibration damping factor. I'll use the logarithmic decrement method. I understand that I must get the min max of 2 cycles in my FV curve.

How to 'point' to the different cycles in my curve? IE. I want to get the min/max of the cycle 1 (before disintegration) and then the 6th cycle after.

Can someone give me advice?


Tags: NI Software

Similar Questions

  • JavaScript for the calculation of tax on income at several levels

    Hello world

    I am writing a script to custom calculation for the calculation of tax on income at several levels:

    1. the income up to $40,000 (20%)

    2. revenue between $40 001 and $60,000 (30%)

    3. revenue between $60 001 and $100,000 (35%)

    4 income more than $100 001 (40%)

    If the income is $ 80,000, tax calculation would be:

    Total tax = (40 000 * 20%) + (20 000 * 30%) + (20 000 * 35%)

    I managed to get the correct calculation for #1 but I'm having a difficult time for the rest. Here is my script to the point #1

    var value = Number (this.getField("Income").value);

    if(nValue<40001) {event.value = math.max (0, nValue * 0.20);}

    }

    else {event.value = 40000 * 0.20;}

    }

    Also, when I tried to change the amounts in the income, the tax has not changed.

    Help, please.

    Thanks in advance.

    I think that you need a script like:

    Event.Value = 0;
    var value = this.getField("Income").value;

    If (value > 0 & nValue)< 40000)="">
    20% of the income;
    NValue = Event.Value *. 2;
    }
    If (value > = 40000 & nValue)< 60000)="">
    30% of income plus 40 000 + 20% of 40000;
    Event.Value = (.3 * (nValue - 40000)) + (.2 * 40000);
    }
    If (value > = 60000 & nValue)< 100000)="">
    amount of 35% more than 60 000 + 30% 20 000 + 20% of the 40,000
    Event.Value = (.35 *(nValue-60000) + (.3 * 20000) + (.2 * 40000);)
    }
    If (value > = 100000) {}
    40% amount plus 100 000 + 35% of 40 000 + 30% of 20000, 20% of the 40,000
    Event.Value = (.4 * (nValue - 100000)) + (.35 * 40000) + (.3 * 20000) + (.2 * 40000);
    }

    To obtain your code, did you check the JavaScript console?

    Understand how interpreted languages handle errors?

  • Strange behavior with MIN MAX at the same time.

    Hi all

    I had a large table of 5100 K records. I created a Unique Index on a column:

    CREATE UNIQUE INDEX TRANS_ID_IDX on TRANS (TRANS_ID);

    When I asked the Table with this these two applications:

    Select min (trans_id) in trans;
    Select max (trans_id) in trans;

    The execution Plan shows INDEX FULL SCAN (MIN/MAX) and the performance is really quickly (0.01 sec) because the optimizer chooses get the value of the index, of course.

    But now, if I ask the table with two operators:

    Select max (trans_id), min (trans_id) in trans;

    I got:

    TABLE ACCESS FULL and indeed it's really slow to get my answer (9 seconds).

    Even if they are shown a suspicion in my request, it does not:

    Select / * + INDEX (TRANS TRANS_ID_IDX) * / max (trans_id), minutes (trans_id) from trans; == > always TABLE FULL ACCESS!

    So why the optimizer does not use INDEX FULL SCAN (MIN/MAX) to the query when the min and max are both both in the query?

    My database is 11.1.0.7 (with the last batch of patches) on Win XP

    Concerning

    SomeoneElse says:
    ... My order_line_detail table has about 42 M lines. order_line_detail_id is the primary key.
    ..

    Primary key does the trick here, or even NOT NULL column definition.

    SQL> drop table dingostar;
    
    Table dropped.
    
    SQL> create table dingostar (id number);
    
    Table created.
    
    SQL> insert into dingostar select rownum as id from dual connect by level <= 5000;
    
    5000 rows created.
    
    SQL> create index dingostar_idx on dingostar(id);
    
    Index created.
    
    SQL> explain plan for
      2  select max(id),min(id) from dingostar;
    
    Explained.
    
    SQL> select * from table(dbms_xplan.display);
    
    PLAN_TABLE_OUTPUT
    ---------------------------------------------------------------------------------------
    Plan hash value: 1182922403
    
    --------------------------------------------------------------------------------
    | Id  | Operation          | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |           |     1 |    13 |     5   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE    |           |     1 |    13 |            |          |
    |   2 |   TABLE ACCESS FULL| DINGOSTAR |  5000 | 65000 |     5   (0)| 00:00:01 |
    --------------------------------------------------------------------------------
    
    Note
    -----
       - dynamic sampling used for this statement
    
    13 rows selected.
    
    SQL>
    SQL> drop table dingostar;
    
    Table dropped.
    
    SQL> create table dingostar (id number primary key);
    
    Table created.
    
    SQL> create index dingostar_idx on dingostar(id);
    create index dingostar_idx on dingostar(id)
                                            *
    ERROR at line 1:
    ORA-01408: such column list already indexed
    
    SQL> insert into dingostar select rownum as id from dual connect by level <= 5000;
    
    5000 rows created.
    
    SQL> explain plan for
      2  select max(id),min(id) from dingostar;
    
    Explained.
    
    SQL> select * from table(dbms_xplan.display);
    
    PLAN_TABLE_OUTPUT
    ---------------------------------------------------------------------------------------
    Plan hash value: 528434344
    
    -------------------------------------------------------------------------------------
    | Id  | Operation             | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
    -------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT      |             |     1 |    13 |     5   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE       |             |     1 |    13 |            |          |
    |   2 |   INDEX FAST FULL SCAN| SYS_C007051 |  5000 | 65000 |     5   (0)| 00:00:01 |
    -------------------------------------------------------------------------------------
    
    Note
    -----
       - dynamic sampling used for this statement
    
    13 rows selected.
    
    SQL>
    SQL> drop table dingostar;
    
    Table dropped.
    
    SQL> create table dingostar (id number not null);
    
    Table created.
    
    SQL> create index dingostar_idx on dingostar(id);
    
    Index created.
    
    SQL> insert into dingostar select rownum as id from dual connect by level <= 5000;
    
    5000 rows created.
    
    SQL> explain plan for
      2  select max(id),min(id) from dingostar;
    
    Explained.
    
    SQL> select * from table(dbms_xplan.display);
    
    PLAN_TABLE_OUTPUT
    ---------------------------------------------------------------------------------------
    Plan hash value: 2124830711
    
    ---------------------------------------------------------------------------------------
    | Id  | Operation             | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT      |               |     1 |    13 |     5   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE       |               |     1 |    13 |            |          |
    |   2 |   INDEX FAST FULL SCAN| DINGOSTAR_IDX |  5000 | 65000 |     5   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------
    
    Note
    -----
       - dynamic sampling used for this statement
    
    13 rows selected.
    
    SQL>
    

    Nicolas.

  • Cannot choose fields for the calculation

    It's very frustrating.

    I change the fields of a form of invoice and want to use the last field of the line to create a total. I select the field and go into its properties. Under the tab 'Calculate', I select "Value is the 'product' of the following" and then click on the "Pick" box to select the fields to be calculated. I am then provided a list of all my fields and I check my selections, and then click OK. But once I click OK, I'm back in the tab calculate with any of my selections in the fields box. Basically, it does not save my selections.

    I tried this all means that I can imagine, rebooted, etc.. Yet, no matter what I can't do to save the field selections that I do for the calculation. I managed to do this successfully for the first line in the form (apparently in full at random) and have not been able to reproduce any success for the following fields. I have check the fields and once I hit OK it ignores them completely.

    Here, any help would be greatly appreciated.

    RP

    After further inspection, it seems that after the field that contains the total bet in shape, I then have to close edition form and re-enter form edition in order to choose the options field for the calculation.

    Very odd behavior, but this is as close I just reproducible results.

  • SQL for the calculation of the salary

    Version: 11.2

    Permanent employees get monthly salary, contract workers get only commission.
    Some permanent employees such as PETER and JOHANN get salary and Commission


    I want to find the total amount paid to permanent and non-permanent.

    The computation of the total, for employees who receive the salary and Commission as PETER and JOHANN, I want to ignore the Commission and considers that pay them for the calculation of total compensation.
    ie. When computing the total amount paid to all these employees
    
        I want to ignore commision of 400 received by PETER 
        and
        I want to ignore commision of 1000 received by  JOHANN
    That is to say. The Total amount paid will be: 18 500

    create table pay_master (emp_type varchar2(50) , empname varchar2(50), salary number , comm number );
    
    
    insert into pay_master values ( 'PERM', 'KAREN' , 2000, 0 );
    insert into pay_master values ( 'PERM', 'HANS'  , 3000, 0 );
    insert into pay_master values ( 'CONTRACT', 'KEITH'  , 0, 1000 );
    
    insert into pay_master values ( 'CONTRACT', 'ABDUL'  , 0, 2000 );
    insert into pay_master values ( 'PERM', 'KRISHNA'  , 1000, 0 );
    insert into pay_master values ( 'CONTRACT', 'CHENG'  , 0, 1500 );
    insert into pay_master values ( 'PERM', 'PETER'  , 5000, 400 );
    insert into pay_master values ( 'PERM', 'JOHANN'  , 3000, 1000 );
    
    
    col EMP_TYPE format a10
    col EMPNAME format a10
    
    SQL> select * From pay_master order by empname;
    
    EMP_TYPE   EMPNAME        SALARY       COMM
    ---------- ---------- ---------- ----------
    CONTRACT   ABDUL               0       2000
    CONTRACT   CHENG               0       1500
    PERM       HANS             3000          0
    PERM       JOHANN           3000       1000           ---------------> Ignore this commision when calculating the total pay
    PERM       KAREN            2000          0
    CONTRACT   KEITH               0       1000
    PERM       KRISHNA          1000          0
    PERM       PETER            5000        400           ---------------> Ignore this commision when calculating the total pay
    
    8 rows selected.
    
    SQL> select EMPNAME , salary+comm from pay_master order by empname;
    
    EMPNAME    SALARY+COMM
    ---------- -----------
    ABDUL             2000
    CHENG             1500
    HANS              3000
    JOHANN            4000
    KAREN             2000
    KEITH             1000
    KRISHNA           1000
    PETER             5400
    
    8 rows selected.
    
    SQL> select sum(salary+comm) from pay_master;
    
    SUM(SALARY+COMM)
    ----------------
               19900
    
    
    Expected output from the SQL with the above mentioned logic is 18500
    How can I do this in SQL? I think that I can't use CASE here statement because the CASE statement works only in a single column. Right?

    Hello

    J.Kiechle wrote:
    ... I think that I can't use CASE here statement because the CASE statement works only in a single column. Right?

    A CASE results in a single value expression. It may depend on any number of columns (that is, of reference): 0, 1, 2, 3 or more.

    For example, the following is based on 2 columns, x and y:

    CASE
        WHEN  x > y
        THEN  x
        ELSE  y
    END
    

    which is just another way to get the same results that

    GREATEST (x, y)
    

    You can use either of the foregoing, for your problem (assuming that the salary and the Commission are always 0 or more).

    Published by: Frank Kulash, Sep 21, 2012 05:40

  • Min - Max and the planning of Kanban

    What are the factors or business cases that should be considered in the choice of planning that we should go?
    Any help would be appreciated

    My Client is interested in the above 2 methods

    Thank you
    Mahendra

    It of a broad question and is not easy to answer.
    One major difference is your philosophy.
    Kanban (if properly implemented) is pull based system.
    Min - max is always anxious that is it looks at your current onhand, future demand, future supply and then comes up with a purchase requisition.

    But there is no hard rule.

    Min - max works well when the issue of subinventory is not placed in a compartment. But in a workshop type of situation, you can have an operator goes the CRUDE inventory to get a bucket of screws.
    If you ran min - max on the WIP subinventory, he will think that you have a lot and does not generate a purchase requisition.
    But another operator may require that these screws and it may be out of them. In this case, a Kanban work better because as soon as the first operator took the last nth bucket, Kanban would have triggered the replenishment process.

    Kanban requires you to spend the time to analyze your problems to get to many of bin sizes and locations.

    The general rule is that Min - Max is simpler to implement.
    Kanban is a bit more complicated. So if your organization is not not mature enough or requires a simpler solution, min - max will work better.

    Sandeep Gandhi

  • Get the date range min/max for consecutive events.

    Hi all...

    I am fairly new to the programming of the DB and is working on some examples I picked up a few places. The database version is 10g R2.

    I would like to configure the data here and I can explain my requirement.

    create table table_1
    (product_id varchar2(25),
    region_id  number,
    event_id number
    event_date date,
    event_status number(1))
    /
    
    
    

    Now the data because it is->

    insert into table_1 values ('Prod-1',10, null, to_date('01-feb-2014','dd-mon-yyyy'),null)
    /
    insert into table_1 values('Prod-1',10, 1001, to_date('10-mar-2014','dd-mon-yyyy'), 1)
    /
    insert into table_1 values('Prod-1',10, 1001, to_date('20-mar-2014','dd-mon-yyyy'), 3)
    /
    insert into table_1 values('Prod-1',10,1002, to_date('01-apr-2014','dd-mon-yyyy'), 1)
    /
    insert into table_1 values('Prod-1',10, 1002, to_date('10-apr-2014','dd-mon-yyyy'), 3)
    /
    commit
    /
    
    
    
    

    If the table now contains the following data

    select * from table_1; 
    
    
    

    PRODUCT_ID REGION_ID EVENT ID EVENT_DAT EVENT_STATUS

    ------------------------- ---------- -------- --------- ------------

    Prod-1 10 1 February 14

    Prod-1 10 1001 10 March 14 1

    Prod-1 10 1001 20 March 14 3

    Prod-1 10 1002 1 April 14 1

    Prod-1 10 1002 April 10, 14 3

    Now, the condition is as follows:

    Above is the dates start and end for the tests on a product in a given region. The event_status column indicates the dates of beginning and end. Event_status = 1, for the date of beginning and the event_status = 3 of the end date.

    A new event is now coming from March 21 and ending on March 31.

    The power required is a product identifier / region; If there are events that are ending and then count the days, for example, 1001 to end on March 20, but now the new event begins on 21 March... and the new event ends on 31 March and event 1002 begins 01 - Apr... and so on.

    The output required for this is as follows:

    PRODUCT_ID REGION_ID EVENT_MIN_DATE EVENT_MAX_DATE

    ------------------------- ---------- -------------- --------------

    Prod-1 10 10 14 March 10 April 14

    The output should give a product identifier / region, when events are immediately after the other, out the min date of beginning and end of max for all these manifestations of "back to back".

    Now I wrote the code for this, but it goes into a purely 'loop' for application in PLSQL... But my head tells me that if the results are correct. the PLSQL implementation is not the most efficient and effective way.

    Can someone help me to form the query? I tried to use functions analytical min/max but it gives me the start and end dates back even if my events are not "back to back" or previous/succeed each other... so my query result is not quite correct.

    Am reading on the TYPE clause but would be grateful if someone could help me with this query... or any other form better to implement this event so PLSQL can be used. The database version is 10g R2.

    Thank you

    K

    PS - The number of such events back to back is limited to 4 and the events could be created in any order. But if someone could help me with the scenario above; am sure I could make a request addressed to any change in the order. :-)

    No this isn't a recursive with clause, perhaps the UNION ALL you got confused. She will work with 10g.

    Since there are 2 tables that you said, the block all_data brings together only the lines of the two tables. table_1 start_date and end_date are built from the event_status (where the max in group by).

  • can I set the min/max for several images at once?

    I brought in my design of the page of photoshop and I don't want the images or text resize when the browser window is made smaller.

    Is there a way to do this without defining every min & max individually?

    I answered my own question in the end, I am proposing to the background of the parent

  • [8i] help with function with parameters (for the calculation of the work)

    Let me start by saying, I've never written a function before, and I do not have access to create a feature in my database (that is, I can't test this feature). I am trying to achieve a function I can ask my IT Department to add for me. I hope that someone can take a look at what I wrote and tell me if this should work or not, and if it's the right way to go to solve my problem.

    I'm creating a function to make a very simple calculation of work (add/subtract a number of days to a date in the calendar).

    The database, I work with has a table with the schedule of work. Here is a sample table and sample data, representative of what is in my work table calendar:
    CREATE TABLE caln
    (     clndr_dt     DATE,
         shop_days     NUMBER(5)
         CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
    );
    
    INSERT INTO     caln
    VALUES (To_Date('01/01/1980','mm/dd/yyyy'),0);
    INSERT INTO     caln
    VALUES (To_Date('01/02/1980','mm/dd/yyyy'),1);
    INSERT INTO     caln
    VALUES (To_Date('01/03/1980','mm/dd/yyyy'),2);
    INSERT INTO     caln
    VALUES (To_Date('01/04/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/05/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/06/1980','mm/dd/yyyy'),3);
    INSERT INTO     caln
    VALUES (To_Date('01/07/1980','mm/dd/yyyy'),4);
    INSERT INTO     caln
    VALUES (To_Date('01/08/1980','mm/dd/yyyy'),5);
    INSERT INTO     caln
    VALUES (To_Date('01/09/1980','mm/dd/yyyy'),6);
    INSERT INTO     caln
    VALUES (To_Date('01/10/1980','mm/dd/yyyy'),7);
    INSERT INTO     caln
    VALUES (To_Date('01/11/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/12/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/13/1980','mm/dd/yyyy'),8);
    INSERT INTO     caln
    VALUES (To_Date('01/14/1980','mm/dd/yyyy'),9);
    The table includes since 01/01/1980 but 31/12/2015.

    I have written (and validated) this parameter query that performs the calculation of my working day (mday):
    SELECT     cal.clndr_dt
    FROM     CALN cal
    ,     (
         SELECT     cal.shop_days+:mdays     AS new_shop_days
         FROM     CALN cal
         WHERE     cal.clndr_dt     =:start_date
         ) a
    WHERE     cal.shop_days     = a.new_shop_days
    AND     ROWNUM          =1
    ORDER BY     cal.clndr_dt;
    Based on this request, I created the following function (and I have no idea if it works or if the syntax is right, etc..):
    CREATE OR REPLACE FUNCTION add_mdays 
         (start_date     IN DATE,
         mdays          IN NUMBER(5))
    RETURN     DATE 
    IS
         new_date DATE;
    BEGIN
    
         SELECT     cal.clndr_dt
         FROM     CALN cal
         ,     (
              SELECT     cal.shop_days+mdays     AS new_shop_days
              FROM     CALN cal
              WHERE     cal.clndr_dt     =start_date
              ) a
         WHERE     cal.shop_days     = a.new_shop_days
         AND     ROWNUM          =1
         ORDER BY     cal.clndr_dt;
    
         RETURN     new_date;
    
    END add_mdays;  //edit 9:31 AM - noticed I left off this bit
    I'm also not sure how to do to have the function handle results that would return a date outside the range of dates that appear in the table (prior to 01/01/1980 or after until 31/12/2015 - or, another way to look at what was, before the caln.clndr_dt or the caln.clndr_dt MAX value MIN value).

    My goal is to be able to use the function in a situation similar to the following:

    First of all, here is a sample table and data:
    CREATE TABLE orders
    (     ord_no          NUMBER(5),
         plan_start_dt     DATE,
         CONSTRAINT orders_pk PRIMARY KEY (ord_no)
    );
    
    INSERT INTO orders
    VALUES (1,To_Date('01/08/1980','mm/dd/yyyy'));
    INSERT INTO orders
    VALUES (2,To_Date('01/09/1980','mm/dd/yyyy'));
    INSERT INTO orders
    VALUES (3,To_Date('01/10/1980','mm/dd/yyyy'));
    And here's how I would use my function:
    SELECT     orders.ord_no
    ,     orders.plan_start_dt
    ,     add_mdays(orders.plan_start_dt, -3) AS prep_date
    FROM     orders
    Thus, the function would allow me to come back, for each command in my table of orders, the date is 3 days working (mdays) before the start of the plan of each order.

    I go about it the right way? I have to create a function to do this, or is there a way for me to integrate my request (which makes my mday calculation) in the example query above (eliminating the need to create a function)?

    Thank you very much in advance!

    Published by: user11033437 on February 2, 2010 08:55
    Fixed some typos in the last insert statements

    Published by: user11033437 on February 2, 2010 09:31 (fixed some syntax in the function)

    Hello

    Ah, referring to Oracle 8 and is not not able to test your own code makes me nostalgic for the good old days, when you have entered your cards and led to a window to the computer center and waited an hour for the work to be performed and then seen printing to find that you had made a typo.

    If you write functions, you should really test yourself. Like all codes, functions forge be written small not: write a line or two (or sometimes just a part of what would later become a single line), test, make sure it is running properly and repeat.
    Ideally, your employer must create a pattern of development in a development database that you can use.
    You can legally download your own instance of Oracle Express Edition free; just be careful not to use features that are not available in the database where the code will be deployed.

    You need a function to get the desired results:

    SELECT       o.ord_no
    ,       o.plan_start_dt
    ,       MIN (e.clndr_dt)     AS prep_date
    FROM       orders     o
    ,       caln          l
    ,       caln          e
    WHERE       l.clndr_dt     = o.plan_start_dt
    AND       e.shop_days     = l.shop_days - 3
    GROUP BY  o.ord_no
    ,            o.plan_start_dt
    ;
    

    It would be more effective (and somewhat simpler) If you've added a column (let's call it work_day) identified whether each line represents a work_day or not.
    For each value of shop_days, exactly 1 row will be considered as a working day.
    Then, the query may be something like:

    SELECT       o.ord_no
    ,       o.plan_start_dt
    ,       e.clndr_dt          AS prep_date
    FROM       orders     o
    ,       caln          l
    ,       caln          e
    WHERE       l.clndr_dt     = o.plan_start_dt
    AND       e.shop_days     = l.shop_days - 3
    AND       e.work_day     = 1
    ;
    

    You can use the analytic LAG function to populate the work_day column.

    A function would certainly be useful, although perhaps slower.

    The function you have posted has some errors:
    an argument can be stated under NUMBER (5); Just NUMBER.
    (b) when you SELECT in PL/SQL, as you do, you must SELECT a variable to store the results.
    (c) ROWNUM is arbitrary (making it useless in this problem) unless you draw a neat subquery. I don't think you can use ORDER BY in subqueries in Oracle 8. Use the ROW_NUMBER analytic function.
    (d) the service must end with an END statement.

    Given your current caln table, here's how I would write the function:

    CREATE OR REPLACE FUNCTION add_mdays
         ( start_date     IN           DATE          DEFAULT     SYSDATE,
           mdays          IN           NUMBER          DEFAULT     1
         )
    RETURN     DATE
    DETERMINISTIC
    IS
         --     add_mdays returns the DATE that is mdays working days
         --     after start_date.  (If mdays < 0, the DATE returned
         --     will be before start_date).
         --     Work days do not include Saturdays, Sundays or holidays
         --     as indicated in the caln table.
    
         new_date     DATE;          -- to be returned
    BEGIN
    
         SELECT     MIN (t.clndr_dt)
         INTO     new_date
         FROM     caln     f     -- f stands for "from"
         ,     caln     t     -- t stands for "to"
         WHERE     f.clndr_dt     = TRUNC (start_date)
         AND     t.shop_days     = f.shop_days + TRUNC (mdays)
         ;
    
         RETURN     new_date;
    END     add_mdays;
    /
    SHOW ERRORS
    

    Production code forge be robust (which includes "fool-proofing").
    Try to anticipate what people errors might appeal to your function and correct for them where possible.
    For example, if it only makes sense for start_date at midnight, mdays to be an integer, use TRUNC in the function where soembody passes a good value.
    Allow default arguments.
    Comment of your function. Put all comments within the service (i.e. after CREATION and before the END) so that they will remain in the data dictionary.
    If, given the same arguments, the function always returns the same value, mark it as DETERMINISTIC, for efficiency. This means that the system will remember the values transmitted rather than to call the function whenever it is said to.

    I wish I could score questions such as 'Correct' or 'useful '; you get 10 points for sure.
    You posted CREATE TABLE and INSERT statements (without even be begged).
    You gave a clear description of the problem, including the expected results.
    The code is well formatted and easy to read.
    All around, one of the more thoughtful and well written questions I've seen.
    Play well! Keep up the good work!

    Published by: Frank Kulash, February 2, 2010 13:10
    Added to my own version of the function.

  • Min / Max in the subquery

    I'm currently doing tests on Oracle, Postgres and MySQL.
    However, Oracle returns me "ORA-00934: Group feature is not allowed here" the same query works with others.

    The idea is to return first, Min, Max, last prices for one day on a particular ID.
    SELECT
      quotes.id,
      min(quotes.received_time) as opening_time,
      (SELECT ask_price FROM "price_quotes" WHERE id=quotes.id AND received_time >=timestamp'2012-12-10 00:00:00' AND received_time < timestamp'2012-12-11 00:00:00' AND received_time=min(quotes.received_time) ) AS opening_price,
      (SELECT received_time FROM "price_quotes" WHERE received_time >=timestamp'2012-12-10 00:00:00' AND received_time < timestamp'2012-12-11 00:00:00' AND id=quotes.id and ask_price=min(quotes.ask_price) LIMIT 1) as min_price_time,
      min(quotes.ask_price) as min_price,
      max(quotes.received_time) as closing_time, 
      (SELECT ask_price FROM "price_quotes" WHERE id=quotes.id AND received_time >=timestamp'2012-12-10 00:00:00' AND received_time < timestamp'2012-12-11 00:00:00' AND received_time=max(quotes.received_time)) as closing_price,
      (SELECT received_time FROM "price_quotes" WHERE received_time >=timestamp'2012-12-10 00:00:00' AND received_time < timestamp'2012-12-11 00:00:00' AND id=quotes.id and ask_price=max(quotes.ask_price) LIMIT 1) as max_price_time,
      max(quotes.ask_price) as max_price
    FROM
      "price_quotes" quotes
    WHERE
      quotes.received_time >= timestamp'2012-12-10 00:00:00' and quotes.received_time < timestamp'2012-12-11 00:00:00'
      AND quotes.id = 668792
    GROUP BY quotes.id ORDER BY quotes.id ;
    I tried to use HAVING and pass the query to the place WHERE but no luck.


    This is the Create Table:
    CREATE TABLE "price_quotes"
    (
       id number(8),
       received_time timestamp, 
       mid_price float, 
       bid_price float,
       ask_price float,
       mid_yield float,
       bid_yield float,
       ask_yield float,
       mid_spread float,
       bid_spread float,
       ask_spread float,
       product_id number(8), 
       product_yield float,
       PRIMARY KEY ( id , received_time )
    );
    Sample data:
    INSERT INTO "price_quotes" VALUES ( 668792, timestamp'2012-12-10 08:00:00', 103, 120, 110, 7, 8, 9, 2.100, 3.050, 4.28999, 29, 1.050);
    INSERT INTO "price_quotes" VALUES ( 668792, timestamp'2012-12-10 10:00:00', 99, 98, 100, 4, 2, 3, 0.100, 0.050, 0.28999, 24, 0.050);
    INSERT INTO "price_quotes" VALUES ( 668792, timestamp'2012-12-10 16:00:00', 100, 99, 101, 5, 3, 4, 0.200, 0.100, 0.29999, 25, 0.100);
    INSERT INTO "price_quotes" VALUES ( 668792, timestamp'2012-12-10 17:00:00', 10, 9, 11, 1, 2, 3, 0.210, 0.330, 0.99, 15, 1.100);
    Oracle: 11.2.0.1.0

    Published by: 986853 on February 7, 2013 12:23

    Hello

    986853 wrote:
    Thanks for the info, I have edited and corrected the post.

    Thank you.
    Be sure to post the results desired from these sample data.

    This is the Create Table:

    CREATE TABLE "price_quotes"
    (
    id number(8),
    received_time timestamp, ...
    

    In Oracle, the names of table in double - quotes are a huge pain.
    In addition, if you do not need to register the fractions of a second, use DATEs instead of TIMESTAMPs. They are more effective, and there are a lot more built-in features for dealing with DATEs.
    Of course, if you're trying to minimize the differences between the databases, which may influence your decision.

    Here are the results you want from the given sample data?

    `       OPENING    OPENING  MIN_ CLOSING    CLOSING MAX_PRICE   MAX_
         ID _TIME       _PRICE PRICE _TIME       _PRICE _TIME      PRICE
    ------- ---------- ------- ----- ---------- ------- ---------- -----
     668792 10-DEC-12      110    11 10-DEC-12       11 10-DEC-12    110
            08.00.00.0               05.00.00.0         08.00.00.0
            00000 AM                 00000 PM           00000 AM
    

    Here's a way to recover them with the FIRST and LAST fucntions aggregate:

    SELECT       id
    ,       MIN (received_time)     AS opening_time
    ,       MIN (ask_price)
               KEEP (DENSE_RANK FIRST ORDER BY received_time)
                                    AS opening_price
    ,         MIN (ask_price)     AS min_price
    ,       MAX (received_time)     AS closing_time
    ,       MIN (ask_price)
               KEEP (DENSE_RANK LAST  ORDER BY received_time)
                                    AS closing_price
    ,       MIN (received_time)
               KEEP (DENSE_RANK LAST  ORDER BY ask_price)
                                    AS max_price_time
    ,       MAX (ask_price)     AS max_price
    FROM       price_quotes
    WHERE       received_time     >= TIMESTAMP '2012-12-10 00:00:00'
    AND       received_time <  TIMESTAMP '2012-12-11 00:00:00'
    -- AND        id           = 668792
    GROUP BY  id
    ORDER BY  id
    ;
    
  • HP 40GS stuck on the hourglass for the calculation of certain integrals

    So I used my calculator HP40GS for awhile, and I've never had problems with it.

    Recently, when reviewing for the examination of calculation AP, I noticed that the calculator could not do some integrals. Because I already went through the lesson using the graphing calculator calculators and integrals without problem using my computer, I don't think that there is nothing special about this one.

    One of the integrals in question is 3 * e ^(-x/2) * sin (2 x) on the interval [0,2].

    I tried to make the home screen capture (in the mode of operation):

    ∫ (0,2,ABS (3rd ^(-x/2) * sin (2 x)), x)

    The calculator has been blocked at least five minutes on the same screen with the little hourglass until I pressed on 'on' to force her to leave.

    Also, I tried to do this in CASE mode, using the manual view. This also does not work.

    Other calculators in the classroom (TI-83) did the integral almost immediately.

    My memory is not yet close to being complete.

    Is there something I could do or check to solve the problem? Other integrals seem to be more or less fine.

    Thank you!

    When you do digital integrals, some of them may take some time. On the 40gs and many other units of HP, the accuracy of the correction is what distinguishes the accuracy of assessment. Try to set the precision of DIFFICULTY 4 in the homescreen of modes and re-evaluate. I suspect that he will return very quickly. That should mean "exact to 4 decimal places.

    You can also try to do exactly in the CASE and then to assess the result. In many cases, it may be faster.

  • set the default name for the calculated channels

    Hello

    The German version, but sometimes the calculated channels serve the Middle English, I use tiara 10.2.

    For example if I use cclasssample with my version of tiara, only the channels named "VKlass_X" and so on

    and with another German version, the canal is named "CompoundClassificationX".

    Where can I configure these behaviors?

    Thank you

    Diademi

    Hello diademi!

    Select the "Einstellungen" menu / "Options" / «Allgemeines...» ». You get the "Allgemeine Einstellungen" dialog box. Click the "Compatibility" button... ». In the dialog box "Compatibility", you have the flag "Sprachunabhangige Ergebniskanalnamen in the ANALYSIS" where you can configure the behavior. If you press Ctrl + A and paste it into a text editor, you can see that it is the CompResChnNaming variable.

    Matthias

  • Validation report for the calculation of the account

    Hi all

    I am using FDM 11.2.1.0 and I came across a little problem.

    When I'm loading data through the workflow once I reached the verification of my report of validation step does all the data.

    For example my validation rule is

    (Total) 1 = (Total counts) 2 + (Total counts) 3

    With values of 15 = 7 + 8

    But when the validation report it comes out doesn´t have all data concerning accounts, it says 0.0 (I know because I am also show the values of Auditors not only the final operation).

    I was reading the manual and saw something on the validation feature, once I added the entity validation, calculation worked.

    The thing is if I believe there is no need for features of validation in order to rethink the role of the calculation. Or I understand entirely the manual?

    Note: The Force calculations under integration options option is checked for the

    Thanks for your help

    A location of FDM is not a related entity of Validation in order to load data to HFM of FDM. However, if no entity is provided in a request for data HFM, HFM how what intersection to come back? An entity is required for any request data HFM. Therefore, in order to extract data for the audit report, the location of the FDM must have a rated entity of Validation. In addition, unless the Validation rules focus on members at the level of the base of all dimensions HFM, box to consolidate the Validation of the entity should be checked to produce data in HFM at intersections that you post. In addition, audit shows only data for Validation entities "on the report" box to checked.

  • Please help, blonde with fields for the calculation of evil!

    URGENT


    I have a question that needs urgent care


    On Adobe Acrobat 9 Pro that I've created a form through import the excel file in adobe, not the help of live program designer. I'm having the problem that the computation of a field based on another field of calculation, it will not always update regularly or properly. When it doesn't, I have to go back and edit form fields, and redo the calculations. This form is intended for multiple users and I need properties to work properly each time, not been hit and Miss. In this case, the purpose of the document is to take different calculations of each page, add the total find VAT on this amount and it amounted to a total. Those are the numbers that continue to change due to the subtotals not automatically updated when a quantity or price has changed.


    Any advice would be most appreciated.


    Very Happy

    Unlike in Excel, in forms Acrobat the field calculation order is not

    determines automatically. So, if you have a field that is, for example, the

    the sum of the fields B and C, then field D which is has * 0.15, if D is not

    After A calculated, it will result in incorrect values.

    To correct this select the object selection tool and then go to the forms - Edit

    Fields - Set field calculation order... and there, change the order of the

    fields in the list to match the desired calculation order.

  • The Script for the calculation of the Vs Web planning security

    Hi all

    I loaded a few accounts one read access to planning and these accounts are calculated by the calculation script. So if the user starts the calculation script will run even if I read access assigned to members in web planning? Read in planning web access has no control over the data which are calculated via the calculation script?

    Please advise!

    Hello

    Why don't you just use of rules of business instead of calc scripts, you have added security and can limit the calculations for what's on forms using variables.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

Maybe you are looking for