Best way to members account cumulatively summarize values?

Hi all

I'm currently an account cumulatively summarizes each month for the next five years. I do that in a calc script explicitly and hope there is a better way to do because currently it's a bit clumky.

I have a time dimension with the following members month1, Month2 month3,..., month250 and 2 members in the Dimension of accounts, inputAccount and sumAccount


inputAccount-> month1 = 100

inputAccount-> Month2 = 200

inputAccount-> months3 = 300

inputAccount-> months4 = 400


with that the sumAccount would be added with the following totals:


sumAccount-> month1 = 100

sumAccount-> Month2 = 300

sumAccount-> months3 = 600

sumAccount-> months4 = 1000

...

sumAccount-> month250 = mois249 + current value, etc.


I would like to

Sorry, I misread the '5' and the example to signify you wanted a sum of 5-period.

I think that you should be able to do it with @PRIOR (SumAccount) + inputAccount.

Tags: Business Intelligence

Similar Questions

  • the best way to deal with the changed values maskMode?

    Hi people

    I just found out that the values listed for maskModes have changed between CC14 and CC15 who broke most of my scripts of masking.

    IE MaskMode.ADD in CC14 has the value 6413 but CC15 is 6813.

    What is the best way to deal with this? is there a simple solution or what I need to check the version of AE which is used and adjust from there?

    is there a direct way to access the name ie "MaskMode.ADD" instead of the value?

    Thanks... /JL

    To get the string maskMode by the current mask, you can loop through all the values possible maskmodes and stop when you click on:

    for (var k in MaskMode){
        if (myMask.maskMode === MaskMode[k]) break;
        };
    // at this stage k is the maskMode string (eg: "ADD")
    

    Xavier

  • What is the best way to achieve this?

    What is the best to do the following?

    Form1 lists items that have a cost value

    Form2 is a form of invoice

    What is the best way to export goods of a value of cost of form1 to form2?

    A user would be making selections of point in form1 and save the form, and then send it or export data.

    Then form2 would retrieve the selections point of form1 and display cost values that I can sum up at the end of the form2.

    Thanks in advance for any advice!

    Hello

    If both forms have the same objects to the items and the same names, then export to xml of form1 and import of xml in form2 should work.

    Data in the xml file that does not match the names of the objects to form2 will be ignored.

    In both forms, objects that you want to export/import must have their liaison, the normal/name of the object value > Bindings tab.

    Niall

  • Is it possible to connect a simple 1 d array to a digital indicator or what would be the best way to display the numeric values of the array on the front panel?

    Is it possible to connect a simple 1 d array to a digital indicator or what would be the best way to display the numeric values of the array on the front panel? Examples or suggestions would be greatly appreciated.

    Thank you

    Tunis

    Thank you Adam, it's originally in a while loop, I placed it in a loop for example, wired County in the for loop and presto, this son of a digital indicator. It works very well. Thanks for the help folks.

  • What is the best way to create a limited user account?

    I'm trying to set up a user account which only allows access to the media, optical drive (read-only, if possible), programs 3 cards and records in a folder that is not visible to this account. What is the best way to go about this?

    Thank you!

    Hello

    You can check the links that has information about the types of accounts of user below.

    Types of user accounts: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ua_c_account_types.mspx?mfr=true

    Overview of user accounts: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/usercpl_overview.mspx?mfr=true

    How to create and configure user accounts in Windows XP: http://support.microsoft.com/kb/279783

  • What is the best way to get to my account with td * removed *.

    I need help what is the best way to laptop.org/gettingstarted using my td account * removed *.

    It is not a good idea to put your name and your bank account on the Internet.

    You need to talk to your bank.

  • Best way to update table attribute with one value calculated from another table JDeveloper

    I have a simple chart. Payment: Payment_Product = Master: detail.

    So first of all, I have to insert in payment, then in Payment_Product. TotalSum default value is null. After validation, I want TotalSum must be calculated according to Product.Price and Payment_Product.Quantity.

    What is the best way to do this in JDeveloper (12.1)?

    payment_product.jpg

    The best way to do that will not do.

    Don't store calculates the basic values unless you have checked, it improves the speed. Otherwise, this will cause almost always more trublen that she enjoys.

    Calculate this total when you do the report. At this point, you have several aggregate function build SQL where sum() is one of them...

    Good bye

    DPT

  • Best way to store the values of the map

    Hi all.

    I have a card <>where I store the values (in this case, I store the IDs of rows in the table). I have an application with a panel tabs and I have a card for each tab. When the user exits the application, I'll go through the card and the identity of any process

    If I use normal in my grain map, once the user changes tab (or opens a pop up or something like that), the map is instantiated again and all data is lost. To resolve this problem, I used a static map. Everything is ok, but if 2 users use the application at the same time, they will share the card data and I don't want that.

    So I have a question: what is the best way to keep my card? I read some people saying to use one Bean of sessionScope, others a pageFlowBean, other parameters of Page, etc...

    Can you help me?

    P.s: jdev version 11.1.2.4.0

    Well, you can create a managed bean in this scope, or you can put your card directly at your fingertips.

    Here you will find several techniques to get the bean managed in java code: http://www.lkakarla.com/2013/06/retrieving-managed-beans.html

    Dario

  • What is the best way to manage Muse 2 accounts on one computer?

    I have a staff and an account of work adobe. I am currently only able to use my personal version of Muse on this computer, but really need to have access to both. What is the best way to switch between these two account on a single computer?

    Found. For anyone else that has this issue, simply go to Adobe Muse > preferences > publish with account > switch account

  • Best way to express Boolean values in a table?

    Hello

    I'm looking for the best way to express Boolean values in a table. Is there a better way than this one?

    Men Women Children
    YesYesNO.
    NO.YesNO.

    Or I guess I could draw that checked sign for Yes and X sign for no.? Or is there anywhere I can download those?

    Thank you!

    That would you say a solid bullet for YES, hollow for no-much easier to see the difference at a glance.

  • [8i] best way to replace the 'similar' value values...?

    Some examples of data:

    Sorry for the large / complex set of sample data, but there should be no need to go through it in detail =).

    2 things to keep in mind:
    (1) it is a 8i db
    (2) I can't create any tables in the db, if I can create views
    CREATE TABLE     ord_master
    (     part_nbr          CHAR(25)
    ,     ord_nbr          CHAR(10)
    ,     sub_ord_nbr     CHAR(3)
    ,     ord_type          CHAR(2)
    ,     ord_stat          CHAR(2)
    ,     date_closed     DATE
    );
    
    -- please note, though none of the columns in ord_master are explicitly defined as NOT NULL, 
    -- none of them are NULL in the db, and given how things are input into the table, I don't 
    -- even think it's possible
    
    -- a unique order is described by ord_nbr, sub_ord_nbr.  there should only be one record in
    -- this table for a given unique combination of those columns, though they are not the p.k.
    
    -- NOTE: dates default to 12/31/1900, so in the table above, if an order is still open (thus, 
    -- not closed), it's date_closed will be 12/31/1900.  It will only change once the order closes.
    
    INSERT INTO     ord_master
    VALUES     ('ABC-123','1','1','AA','CL',TO_DATE('05/01/2009','mm/dd/yyyy'));
    INSERT INTO     ord_master
    VALUES     ('ABC-123','1','2','AA','CL',TO_DATE('9/14/2009','mm/dd/yyyy'));
    INSERT INTO     ord_master
    VALUES     ('ABC-123','2','1','AA','CL',TO_DATE('12/03/2009','mm/dd/yyyy'));
    INSERT INTO     ord_master
    VALUES     ('ABC-123','3','1','AA','OP',TO_DATE('12/31/1900','mm/dd/yyyy'));
    INSERT INTO     ord_master
    VALUES     ('ABC-123','4','1','AA','CL',TO_DATE('03/12/2004','mm/dd/yyyy'));
    INSERT INTO     ord_master
    VALUES     ('XYZ-123','5','1','AA','CL',TO_DATE('03/12/2004','mm/dd/yyyy'));
    
    
    CREATE TABLE     op_detail
    (     ord_nbr          CHAR(10)
    ,     sub_ord_nbr     CHAR(3)
    ,     major_seq_nbr     CHAR(4)
    ,     wctr_id          CHAR(5)
    ,     oper_stat          CHAR(2)
    ,     plan_su_rsrc     NUMBER(5,2)
    ,     plan_run_rsrc     NUMBER(11,8)
    ,     plan_subc_amt     NUMBER(15,5)
    ,     act_su_rsrc     NUMBER(5,2)
    ,     act_run_rsrc     NUMBER(7,2)
    ,     act_subc_amt     NUMBER(15,2)
    ,     act_start_dt     DATE
    ,     dt_completed     DATE
    ,     qty_planned     NUMBER(13,4)
    ,     qty_recvd          NUMBER(13,4)
    ,     qty_complete     NUMBER(13,4)
    ,     qty_scrap          NUMBER(13,4)
    ,     qty_on_hold     NUMBER(13,4)
    );
              
    -- similar to ord_master, thought none of the columns are explicitly defined as NOT NULL, 
    -- none of the records have NULL values for any of these columns, and I don't think it's 
    -- really possible with the way the system is
    
    INSERT INTO     op_detail
    VALUES     ('1', '1', '0081', 'X516 ', 'CP', 0, 0, 0, 0, .2, 0, TO_DATE('02/03/2010', 'mm/dd/yyyy'), TO_DATE('02/03/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('1', '1', '0324', 'Y000 ', 'CP', .1, .2, 0, 0, .87, 0, TO_DATE('04/06/2010', 'mm/dd/yyyy'), TO_DATE('04/06/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('1', '1', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 159, TO_DATE('03/05/2010', 'mm/dd/yyyy'), TO_DATE('03/05/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('1', '1', '0130', 'H211 ', 'CP', .5, .1, 0, .08, .63, 0, TO_DATE('02/10/2010', 'mm/dd/yyyy'), TO_DATE('02/10/2010', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('1', '2', '0120', 'H214 ', 'CP', .3, .05, 0, 0, .68, 0, TO_DATE('05/22/2009', 'mm/dd/yyyy'), TO_DATE('05/22/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('1', '2', '0122', 'T203 ', 'CP', 2.5, 1, 0, .67, .3, 0, TO_DATE('05/28/2009', 'mm/dd/yyyy'), TO_DATE('05/28/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('1', '2', '0130', 'H211 ', 'CL', .5, .1, 0, .67, .3, 0, TO_DATE('05/28/2009', 'mm/dd/yyyy'), TO_DATE('05/28/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('1', '2', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 153.12, TO_DATE('06/10/2009', 'mm/dd/yyyy'), TO_DATE('06/10/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('1', '2', '0324', 'Y000 ', 'CP', .1, .2, 0, 0, .08, 0, TO_DATE('06/17/2009', 'mm/dd/yyyy'), TO_DATE('06/17/2009', 'mm/dd/yyyy'), 3, 3, 3, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('2', '1', '0081', 'X516 ', 'CL', 0, 0, 0, 0, 0, 0, TO_DATE('07/20/2009', 'mm/dd/yyyy'), TO_DATE('07/20/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('2', '1', '0324', 'Y000 ', 'CL', .1, .2, 0, 0, 3.03, 0, TO_DATE('09/11/2009', 'mm/dd/yyyy'), TO_DATE('09/11/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('2', '1', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 204.16, TO_DATE('08/11/2009', 'mm/dd/yyyy'), TO_DATE('08/11/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('2', '1', '0130', 'H211 ','CP', .5, .1, 0, 1.97, 2.67, 0, TO_DATE('07/28/2009', 'mm/dd/yyyy'), TO_DATE('07/29/2009', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('3', '1', '0170', 'X928 ', 'CP', 0, 0, 9.6, 0, 0, 255.2, TO_DATE('11/06/2009', 'mm/dd/yyyy'), TO_DATE('11/06/2009', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('3', '1', '0130', 'H212 ', 'CP', .5, .1, 0, .6, .03, 0, TO_DATE('10/21/2009', 'mm/dd/yyyy'), TO_DATE('10/21/2009', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('3', '1', '0550', 'R501 ', 'WK', 1, 16, 0, 2.2, 12.4, 0, TO_DATE('05/19/2010', 'mm/dd/yyyy'), TO_DATE('12/31/1900', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('3', '1', '0324', 'Y000 ', 'CL', .1, .2, 0, 0, .07, 0, TO_DATE('02/04/2010', 'mm/dd/yyyy'), TO_DATE('02/04/2010', 'mm/dd/yyyy'), 5, 5, 5, 0, 0);
    INSERT INTO     op_detail
    VALUES     ('4', '1', '0324', 'Y000 ', 'CP', .1, .2, 0, 0, .59, 0, TO_DATE('02/06/2004', 'mm/dd/yyyy'), TO_DATE('02/06/2004', 'mm/dd/yyyy'), 4, 4, 4, 0, 0);
    This is the query, I'm working with right now:
    SELECT     o.part_nbr               
    ,          s.major_seq_nbr          AS op_nbr
    ,          CASE          -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
                   WHEN     s.wctr_id     IN ('H211','H212')
                   THEN     'Z211'
                   ELSE     s.wctr_id
              END                         AS wctr
    ,          MIN(s.plan_su_rsrc)          AS min_plan_setup
    ,          AVG(s.plan_su_rsrc)          AS avg_plan_setup
    ,          MAX(s.plan_su_rsrc)          AS max_plan_setup
    ,          STDDEV(s.plan_su_rsrc)     AS sdev_plan_setup
    ,          MIN(s.plan_run_rsrc)     AS min_plan_run
    ,          AVG(s.plan_run_rsrc)     AS avg_plan_run
    ,          MAX(s.plan_run_rsrc)     AS max_plan_run
    ,          STDDEV(s.plan_run_rsrc)     AS sdev_plan_run
    ,          MIN(s.plan_subc_amt)     AS min_plan_subc
    ,          AVG(s.plan_subc_amt)     AS avg_plan_subc
    ,          MAX(s.plan_subc_amt)     AS max_plan_subc
    ,          STDDEV(s.plan_subc_amt)     AS sdev_plan_subc
    ,          MIN(s.act_su_rsrc)          AS min_act_setup
    ,          AVG(s.act_su_rsrc)          AS avg_act_setup
    ,          MAX(s.act_su_rsrc)          AS max_act_setup
    ,          STDDEV(s.act_su_rsrc)     AS sdev_act_setup
    ,          MIN(s.act_run_rsrc)          AS min_act_run
    ,          AVG(s.act_run_rsrc)          AS avg_act_run
    ,          MAX(s.act_run_rsrc)          AS max_act_run
    ,          STDDEV(s.act_run_rsrc)     AS sdev_act_run
    ,          MIN(s.act_subc_amt)          AS min_act_subc
    ,          AVG(s.act_subc_amt)          AS avg_act_subc
    ,          MAX(s.act_subc_amt)          AS max_act_subc
    ,          STDDEV(s.act_subc_amt)     AS sdev_act_subc     
    ,          MIN(s.act_start_dt)          AS min_start
    ,          MAX(s.act_start_dt)          AS max_start
    ,          MIN(s.dt_completed)          AS min_comp
    ,          MAX(s.dt_completed)          AS max_comp
    ,          MIN(s.qty_planned)          AS min_qty_plan
    ,          AVG(s.qty_planned)          AS avg_qty_plan
    ,          MAX(s.qty_planned)          AS max_qty_plan
    ,          STDDEV(s.qty_planned)     AS sdev_qty_plan
    ,          MIN(s.qty_recvd)          AS min_qty_recvd
    ,          AVG(s.qty_recvd)          AS avg_qty_recvd
    ,          MAX(s.qty_recvd)          AS max_qty_recvd
    ,          STDDEV(s.qty_recvd)          AS sdev_qty_recvd
    ,          MIN(s.qty_complete)          AS min_qty_comp
    ,          AVG(s.qty_complete)          AS avg_qty_comp
    ,          MAX(s.qty_complete)          AS max_qty_comp
    ,          STDDEV(s.qty_complete)     AS sdev_qty_comp
    ,          MIN(s.qty_scrap)          AS min_qty_scrap
    ,          AVG(s.qty_scrap)          AS avg_qty_scrap
    ,          MAX(s.qty_scrap)          AS max_qty_scrap
    ,          STDDEV(s.qty_scrap)          AS sdev_qty_scrap
    ,          MIN(s.qty_on_hold)          AS min_qty_hold
    ,          AVG(s.qty_on_hold)          AS avg_qty_hold
    ,          MAX(s.qty_on_hold)          AS max_qty_hold
    ,          STDDEV(s.qty_on_hold)     AS sdev_qty_hold
    ,          COUNT(*)                    AS rec_cnt
    ,          CASE
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-12)
                   THEN     '12 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-24)
                   THEN     '24 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-36)
                   THEN     '36 mos. back'
                   ELSE '37 mos. back +'
              END                         AS time_period
    FROM          ord_master o
    ,          op_detail     s
    ,          (     -- begin in-line view a, to get the min act_start_dt for each order
              SELECT     s1.ord_nbr
              ,          s1.sub_ord_nbr
              ,          MIN     (
                             CASE
                                  WHEN     s1.act_start_dt     > TO_DATE('01/01/2000','mm/dd/yyyy')
                                  THEN     s1.act_start_dt
                             END
                             )          AS ord_min_start
              FROM          op_detail s1
              GROUP BY     s1.ord_nbr
              ,          s1.sub_ord_nbr
              ) a     -- end in-line view a          
    WHERE     o.ord_nbr          = s.ord_nbr
    AND          o.sub_ord_nbr     = s.sub_ord_nbr
    AND          o.ord_nbr          = a.ord_nbr
    AND          o.sub_ord_nbr     = a.sub_ord_nbr
    AND          o.ord_type     = 'AA'
    AND          o.ord_stat     IN ('CL','OP')
    AND          s.oper_stat     IN ('CL','CP')
    GROUP BY     o.part_nbr
    ,          s.major_seq_nbr
    ,          CASE          -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
                   WHEN     s.wctr_id     IN ('H211','H212')
                   THEN     'Z211'
                   ELSE     s.wctr_id
              END
    ,          CASE
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-12)
                   THEN     '12 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-24)
                   THEN     '24 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-36)
                   THEN     '36 mos. back'
                   ELSE '37 mos. back +'
              END
    ORDER BY     o.part_nbr
    ,          CASE
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-12)
                   THEN     '12 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-24)
                   THEN     '24 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-36)
                   THEN     '36 mos. back'
                   ELSE '37 mos. back +'
              END
    ,          s.major_seq_nbr
    It gives me a lot of descriptive statistics on data stored in the database, divided into groups of the time period.

    I have 7 sets of possible values for the wctr_id column, which are groups of similar/identical positions and should be treated as the same, assuming that the ord_nbr, sub_ord_nbr and major_seq_nbr are the same. In my case statement example above, every time I find 'H211' or 'H212', I'm replacing it with "Z211', which is my new unique identifier for all wctr in the Group ("H211', "H212"). I have 7 of these kinds of groups that should be replaced by a new unique identifier. Is my statement CASE (above) the best way to do it, or is there a better way? These groups of similar-wctr_id are not listed in a table anywhere.

    Hello

    As always, thanks for posting the CREATE TABLE and INSERT statements. It is very useful and leads to the more quickly, better solutions.
    Another thing that is useful and promotes better solutions, faster, is to simplify your problem.
    For example, you need to calculate a large number of aggregates, but looks like you already know how to do this. This issue only affects the CASE expressions, and how they interact with the GROUP BY clause. So just cut most of the aggregate functions.
    Also, it seems that the finer points of view one online have nothing to do with your current problem. For purposes of recognition of this problem, pretend that one is a regular display, so it does not clutter the main request.

    I think your problem might be reformulated as follows:
    You already have a query like this:

    CREATE OR REPLACE VIEW a
    AS
              SELECT     s1.ord_nbr
              ,          s1.sub_ord_nbr
              ,          MIN     (
                             CASE
                                  WHEN     s1.act_start_dt     > TO_DATE('01/01/2000','mm/dd/yyyy')
                                  THEN     s1.act_start_dt
                             END
                             )          AS ord_min_start
              FROM          op_detail s1
              GROUP BY     s1.ord_nbr
              ,          s1.sub_ord_nbr
    ;
    
    SELECT     o.part_nbr
    ,          s.major_seq_nbr          AS op_nbr
    ,          CASE          -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
                   WHEN     s.wctr_id     IN ('H211','H212')
                   THEN     'Z211'
                   ELSE     s.wctr_id
              END                         AS wctr
    ,          MIN(s.plan_su_rsrc)          AS min_plan_setup
              -- lots of other agtgregates go here in real query
    ,          CASE
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-12)
                   THEN     '12 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-24)
                   THEN     '24 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-36)
                   THEN     '36 mos. back'
                   ELSE '37 mos. back +'
              END                         AS time_period
    FROM          ord_master o
    ,          op_detail     s
    ,          a          -- in real query, a is an in-line view
    WHERE     o.ord_nbr          = s.ord_nbr
    AND          o.sub_ord_nbr     = s.sub_ord_nbr
    AND          o.ord_nbr          = a.ord_nbr
    AND          o.sub_ord_nbr     = a.sub_ord_nbr
    AND          o.ord_type     = 'AA'
    AND          o.ord_stat     IN ('CL','OP')
    AND          s.oper_stat     IN ('CL','CP')
    GROUP BY     o.part_nbr
    ,          s.major_seq_nbr
    ,          CASE          -- CASE statement to replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
                   WHEN     s.wctr_id     IN ('H211','H212')
                   THEN     'Z211'
                   ELSE     s.wctr_id
              END
    ,          CASE
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-12)
                   THEN     '12 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-24)
                   THEN     '24 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-36)
                   THEN     '36 mos. back'
                   ELSE '37 mos. back +'
              END
    ORDER BY     o.part_nbr
    ,          CASE
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-12)
                   THEN     '12 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-24)
                   THEN     '24 mos. back'
                   WHEN a.ord_min_start     >     ADD_MONTHS(SYSDATE,-36)
                   THEN     '36 mos. back'
                   ELSE '37 mos. back +'
              END
    ,          s.major_seq_nbr
    ;
    

    which produces this output:

    `                       MIN_
                           PLAN_
    PART_NBR   OP_N WCTR   SETUP TIME_PERIOD
    ---------- ---- ----- ------ --------------
    ABC-123    0081 X516      .0 12 mos. back
    ABC-123    0130 Z211      .5 12 mos. back
    ABC-123    0170 X928      .0 12 mos. back
    ABC-123    0324 Y000      .1 12 mos. back
    ABC-123    0120 H214      .3 24 mos. back
    ABC-123    0122 T203     2.5 24 mos. back
    ABC-123    0130 Z211      .5 24 mos. back
    ABC-123    0170 X928      .0 24 mos. back
    ABC-123    0324 Y000      .1 24 mos. back
    ABC-123    0324 Y000      .1 37 mos. back +
    

    The output is correct; the problem is, can we get the same results without 2 copies of the expression BOX wctr and 3 copies of the expression BOX time_period?
    What is a good description of the problem?

    To start, you can use aliases for columns in the ORDER BY clause. Unfortunately, it's the only place where you can use column aliases in the same query, where they are defined . You can calculate them in a query-sib and then use them in queries Super.
    In other words, wouldn't be nice if we had a table just like op_detail, but with an extra column called wctr? Make a view: either a regular view (especially if wctr, calculated in the same way, to be used for several different queries) or view online, as shown below.
    Wouldn't be great if there was a table that was like a, except that he had calculated alreay time_period? Make a view: either a regular view, or a view online, as shown below.

    SELECT     o.part_nbr
    ,     s.major_seq_nbr          AS op_nbr
    ,     s.wctr
    ,     MIN(s.plan_su_rsrc)          AS min_plan_setup
         -- lots of other agtgregates go here in real query
    ,     a2.time_period
    FROM     ord_master      o
    ,     (          -- Begin in-line view s, with data from op_detail
                 SELECT  op_detail.*      -- or list all columns needed in main query
              ,     CASE          -- replace similar-to wctr_id's with a single new wctr_id, so we can treat them as the same
                       WHEN     wctr_id        IN ('H211','H212')
                       THEN     'Z211'
                       ELSE     wctr_id
                   END                    AS wctr
              FROM     op_detail
         ) s          -- End in-line view s, with data from op_detail
    ,     (           -- Begin in-line view a2, to compute time_period
              SELECT  a.*
              ,     CASE
                       WHEN ord_min_start     >     ADD_MONTHS(SYSDATE,-12)
                           THEN     '12 mos. back'
                           WHEN ord_min_start     >     ADD_MONTHS(SYSDATE,-24)
                           THEN     '24 mos. back'
                           WHEN ord_min_start     >     ADD_MONTHS(SYSDATE,-36)
                           THEN     '36 mos. back'
                           ELSE '37 mos. back +'
                   END                         AS time_period
              FROM     a          -- in real query, a is an in-line view
         ) a2          -- End in-line view a2, to compute time_period
    WHERE     o.ord_nbr     = s.ord_nbr
    AND     o.sub_ord_nbr     = s.sub_ord_nbr
    AND     o.ord_nbr     = a2.ord_nbr
    AND     o.sub_ord_nbr     = a2.sub_ord_nbr
    AND     o.ord_type     = 'AA'
    AND     o.ord_stat     IN ('CL','OP')
    AND     s.oper_stat     IN ('CL','CP')
    GROUP BY     o.part_nbr
    ,          s.major_seq_nbr
    ,          s.wctr
    ,          a2.time_period
    ORDER BY     o.part_nbr
    ,          a2.time_period
    ,          s.major_seq_nbr
    ;
    

    In your example, wctr is identical to wctr_id, except for two values. If it was more complicated (for example, if there is not only 2 values that must be mapped on 'Z211', but also 3 to did not amount to "Z987", and 1 which should be treated as "A012" and 5 who should appear as "A666" and...), then you pourriez encode this in an expression BOX humongeous (one nested expression BOX if it involves more than 128 branches) , but it actually belongs to a table, where you have the gross wctr_id (such as "H211") in a column and its equivalent correspondent (for example "Z211") in another. I know that you said that you cannot create new tables; I'm just pointing out that then you can tell people that won't let you create tables, it's a bad idea, likely to lead to errors and some time in the future.

  • What is the best way to get the minimum or maximum of a table of numbers value?

    Let's say I have a table of numbers: [2,3,3,4,2,2,5,6,7,2]

    What is the best way to find the minimum or maximum value in the table?

    Now, just get the maximum, I'm a loop in the table and reset a variable to the value if it is greater than the existing value:

    What I ended up doing was sorting table (descending to MAX) upward for MIN and then grabbing the first element of the array. Works like a charm in very few lines of code.

    Thank you.

  • Best way to select distinct values, based on another column?

    I have a table with three columns: id (NUMBER), data_dt (DATE) and data_value (NUMBER).
    There is a primary key id and data_dt.

    I want to choose the folder with the last data_dt for each unique identification number.

    What is the best way to do it?
    I have three different methods, but there may be something that I am missing.

    First of all:
    SELECT *
    FROM
    (
      SELECT id, data_dt, data_value,
             FIRST_VALUE(data_dt)
             OVER (PARTITION BY id ORDER BY data_dt DESC) AS last_data_dt
      FROM the_table
    )
    WHERE data_dt = last_data_dt;
    (I use ORDER BY... DESC, instead of just ORDER BY I don't need the clause BETWEEN the LINES)


    Second:
    SELECT t1.*
    FROM the_table t1
    JOIN
    (
      SELECT id, MAX(data_dt) AS last_data_dt
      FROM the_table
      GROUP BY id
    ) t2 ON (t2.id = t1.id AND t2.data_dt = t1.data_dt);
    Third:
    SELECT t1.*
    FROM the_table t1
    WHERE t1.data_dt =
    (
      SELECT MAX(t2.data_dt)
      FROM the_table t2
      WHERE t2.id = t1.id
    );
    -Don

    As mentioned in hoek, you will need to test all scenarios.

    However, in my opinion the more faster will be those who accesses the table that only ONCE instead of TWICE as some scenarios require.

    HTH!

  • INTERFACE design - what is the best way to allow the user to define a kind of infusion at various times (non-periodic)?

    I want to allow the user to specify a curve like this:

    Such as some under - VI shows the A2 value when a variable of time is between R1, A1 when the time variable is between A2 and A3 when time is in the range A3.

    My design looks like this:

    With the error checking that looks like this:

    My question is, is the approach of the table according to optimal? Otherwise, how could combat this?

    I think I can summarize the conversation on this point as a response to the original question (what is the best way...) -to start writing code, to think about what you want to accomplish and write it down (otherwise known as 'Write the first Documentation').  One of the points of a good User Interface is that it is not allow users to "stupid mistakes" - it leads the user "by hand", limiting the entries to the "legal values" and demanding that the entries be made logically.

    If you were going to have a list of Infusions to enter, it is therefore logical to decide or not to enter into time intervals (which are always > 0) or order the times (which, logically) are still growing.  You can (and should) decide that you (or you may have a control that allows the user decide, but maybe it's too flexible) and then apply your "rules".

    Let's say you've decided on "Intervals" (which seems to me to be more User Friendly).  After the user has entered the intervals (and you've provided a nice plot of perfusion vs. time), pouvez allow you the user to an interval of 'split', 'Delete' an interval, or "Edit the Infusion" interval, or you can decide to have a choice more simple "accept or start again" - If you have only a few intervals, the last would be the simplest (and therefore best) design choice.

    Spend more time thinking before coding usually pays Big dividends!

    (Speaking of sad experience) Bob Schor

  • best way to add a CURVES layer

    Hi all

    I am writing to you the best way to add an ArtLayer with a script.

    I already know that it is possible to add an Artlayer, and then change the layer.kind to the TEXT property.

    But unfortunately it is not possible to add change this property to LayerKind.CURVES.


    Here is an example

    /**
     * Function to add a layer to a Document
     * @param {LayerKind} layer_kind, the type of the layer (CURVES, TEXT, SELECTIVECOLOR)
     * @param {Document|LayerSet} [obj = app.activeDocument] the obj which contains the new layer
     * @return {ArtLayer} layer the added layer
     * @todo add a better test to check if layer_kind is an enum of LayerKind
     * @toto add control the layer is background or not
     * @todo https://forums.adobe.com/thread/1601245
     */
    my.add = function (name, layer_kind, obj) {
    
       if (obj === undefined) {
       var obj = app.activeDocument;
      }
    
       if (typeof layer_kind !== 'object') {
       throw {
       name: 'InvalidArgumentError',
       message: 'you must enter a valid value for the param layer_kind [CURVES, TEXT, SELECTIVECOLOR, etc.]',
       fileName: $.fileName,
       lineNumber: $.line
       };
      }
    
       var layer = obj.artLayers.add();
    
       layer.kind = layer_kind;
       layer.name = name;
    
       return layer;
    
    }
    

    So the only way to add different type of layer should use listener Action Script?

    I'm a little confused, because it would be much better to be able to change the layer.kind property.

    In advance, thank you very much for your help.
    Best account.

    Don't forget your does not deal with Adobe here it is the user forums.  If you want changes made to Photoshop scripts that you need to address Adobe please use Photoshop family customer community and submit a suggestion.

    Adobe DOM is limited without Manager Action code via ScriptListener Photoshop script script is not very useful because limited methods of model DOM of Adobe Photoshop. Many Photoshop features are not supported and the supported features can be supported in a limited way.

Maybe you are looking for

  • JETech 2010 keyboard no longer works correctly!

    Keyboard no longer works. At least remove them and T keys do nothing. I have blue tooth, forgotten unit redefined and networks... Any other ideas please? Thanks in advance X

  • Program legitimate for clean Mac

    I accidentally installed adware on my mac a month ago.  I was getting pop ups like crazy.  I removed mackeeper to move to the trash and empty the trash, but I always get an announcement whenever I restart my Mac.  I'm a little worried that it lasts a

  • Satellite Pro 6100 has no Wlan

    Installed xp on a Satellite Pro 6100 and it has no wireless network adapter in the Device Manager to all, and it does not appear in "Found new hardware" or whatever it is.I downloaded the drivers, but I can't put anywhere.

  • Ultiboard - unable to get a connector SCSI 68

    New to Ultiboard, so I could use some help! We were able to create a fingerprint for line 4, staggered 68 pins SCSI Connector (Honda PCS-E68LMD). The netlist identifies all serving pine when the part is imported from Ultiboard 10.1, but Ultiboard wil

  • HP 15-r249TU: display driver for HP 15-r249TU

    Hello I recently put a computer laptop 15-r249tu HP with back and subsequently installed windows 7(64 bit) in it, later, I found that the function keys keyboard (f2 and f3) for brightness adjustment does not work, I want to set my brightness level, f