Workday calculation

Hi Gurus,
I have late start date and late finish date for an order, which could span for more than a month obviously.
I want the working days split in months taking the holidays n weekend into consideration.
can anyone help?

Hi,
Take a look on the thread:
Re: Number of working days(exlude Saturday and Sunday)
With rgds,
Anil Kumar Sharma .P

Similar Messages

  • [8i] Help with function with parameters (for workday calculation)

    Let me start by saying, I've never written a function before, and I don't have access to create a function in my database (i.e. I can't test this function). I'm trying to come up with a function that I can ask my IT department to add for me. I'm hoping someone can take a look at what I've written and tell me if it should work or not, and if this is the right way to go about solving my problem.
    I am trying to create a function to do a very simple workday calculation (adding/subtracting a particular number of workdays from a calendar date).
    The database I'm working with has a table with the workday calendar in it. Here is a sample table and sample data, representative of what's in my workday calendar table:
    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 actual table includes from 1/1/1980 though 12/31/2015.
    I've written (and validated) this parameter query which does my workday (mday) calculation:
    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 query, I've created the following function (and I have no clue 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 bitI'm also not sure how to have the function handle results that would return a date outside of the date range that is in the table (Before 1/1/1980 or after 12/31/2015--or, another way to look at it is, before the MIN value of caln.clndr_dt or after the MAX value of caln.clndr_dt).
    My goal is to be able to use the function in a situation like the following:
    First, here's 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 is how I would like to use my function:
    SELECT     orders.ord_no
    ,     orders.plan_start_dt
    ,     add_mdays(orders.plan_start_dt, -3) AS prep_date
    FROM     ordersThus, the function would allow me to return, for every order in my orders table, the date that is 3 workdays (mdays) prior to the plan start date of each order.
    Am I going about this the right way? Do I need to create a function to do this, or is there a way for me to incorporate my query (that does my mday calculation) into the sample query above (eliminating the need to create a function)?
    Thanks much in advance!
    Edited by: user11033437 on Feb 2, 2010 8:55 AM
    Fixed a couple typos in the last insert statements
    Edited by: user11033437 on Feb 2, 2010 9:31 AM (fixed some syntax in the function)

    Hi,
    Ah, mentioning Oracle 8 and not being able to test your own code makes me nostalgic for the good old days, when you typed your cards, and brought them to a window at the computer center, and waited an hour for the job to run, and then saw the printout to find that you had made a typo.
    If you're going to write functions, you really need to test them yourself. Like all code, functions whould be written in baby steps: write a line or two (or sometimes just part of what will later become one line), test, make sure it's running correctly, and repeat.
    Ideally, your employer should create a developement schema in a development database for you to use.
    You can legally download your own instance of Oracle Express Edition for free; just be careful not to use features that aren't available in the database where the code will be deployed.
    You don't need a function to get the results you want:
    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
    ;This would be more efficient (and a little simpler) if you added a column (let's call it work_day) that identified if each row represented a work_day or not.
    For each value of shop_days, exactly 1 row will be marked as a work day.
    Then the query might 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 could use the analytic LAG function to populate the work_day column.
    A function would certainly be handy, though perhaps slower.
    The function you posted has a few mistakes:
    (a) An argument can't be declared as NUMBER (5); just NUMBER.
    (b) When you SELECT in PL/SQL, like you're doing, you have to SELECT INTO some variable to hold the results.
    (c) ROWNUM is arbitrary (which makes it useless in this problem) unless you are drawing from an ordered sub-query. I don't think you can use ORDER BY in sub-queries in Oracle 8. Use the analytic ROW_NUMBER function instead.
    (d) The function 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 ERRORSProduction code whould be robust (that includes "idiot-proofing").
    Try to foresee what errors people might make in calling your function, and correct for them when possible.
    For example, if it only makes sense for start_date to be midnight, or mdays to be an integer, then use TRUNC in the function in case soembody passes a bad value.
    Allow for default arguments.
    Comment your function. Put all comments within the function (that is, after CREATE and before the final END) so that they will be kept in the data dictionary.
    If, given the same arguments, the function always returns the same value, mark it as DETERMINISTIC, for efficiency. This means the system may remember values passed back rather than call the function every time it is told to.
    I wish I could mark questions as "Correct" or "Helpful"; you'd get 10 points for sure.
    You posted CREATE TABLE and INSERT statements (without even being begged).
    You gave a clear description of the problem, including desired results.
    The code is nicely formatted and easy to read.
    All around, one of the most thoughtful, well-written questions I've seen.
    Well done! Keep up the good work!
    Edited by: Frank Kulash on Feb 2, 2010 1:10 PM
    Added my own version of the function.

  • [8i] Need help with some workday calculations

    At the beginning of the month, I got help with a workday calculation in: [8i] Help with function with parameters (for workday calculation)
    Now, as it turns out, I was able to locate a function in the database that does what I want, however, it is much slower to use the function than to join two copies of the CALN table (Please see referenced thread for details. I can copy them to this thread if necessary.) I need to verify that the pre-existing function has 'DETERMINISTIC' in it, as I would guess that if it doesn't, it would be much slower than it could be.
    But now, I've come across a situation where I have to do multiple workday calculations in the same query--enough that I have to join 6 copies of my CALN table. I can't imagine that is at all efficient. I believe it was Frank K. who said (in the original thread) that if the function was slow, I should consider alternatives. Can anyone help me identify some of those alternatives? I'm definitely at that point now. (This query is one I'm using as the base for a report in Oracle BI, and let's just say it doesn't like my query, even though my syntax appears to be correct, and I would guess that joining 6 copies of one table is at least partly to blame for this).
    Note: I'm working with Oracle 8i

    OK, I finally have some sample data... I tried to make it thorough. I've included data in the CALN table YTD + tomorrow, so that any workday calculations using SYSDATE will work.
    CREATE TABLE caln
    (     clndr_dt     DATE          NOT NULL
    ,     clndr_yr     NUMBER
    ,     shop_day     NUMBER
    ,     shop_dt          DATE
    ,     shop_wk          NUMBER
    ,     shop_yr          NUMBER
    ,     shop_days     NUMBER
    ,     clndr_days     NUMBER
         CONSTRAINT caln_pk PRIMARY KEY (clndr_dt)
    INSERT INTO     caln
    VALUES (To_Date('12/23/2009','mm/dd/yyyy'),2009,247,To_Date('12/23/2009','mm/dd/yyyy'),51,2009,7631,10950);
    INSERT INTO     caln
    VALUES (To_Date('01/01/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10959);
    INSERT INTO     caln
    VALUES (To_Date('01/02/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),52,2009,7631,10960);
    INSERT INTO     caln
    VALUES (To_Date('01/03/2010','mm/dd/yyyy'),2010,0,To_Date('12/23/2009','mm/dd/yyyy'),1,2010,7631,10961);
    INSERT INTO     caln
    VALUES (To_Date('01/04/2010','mm/dd/yyyy'),2010,1,To_Date('01/04/2010','mm/dd/yyyy'),1,2010,7632,10962);
    INSERT INTO     caln
    VALUES (To_Date('01/05/2010','mm/dd/yyyy'),2010,2,To_Date('01/05/2010','mm/dd/yyyy'),1,2010,7633,10963);
    INSERT INTO     caln
    VALUES (To_Date('01/06/2010','mm/dd/yyyy'),2010,3,To_Date('01/06/2010','mm/dd/yyyy'),1,2010,7634,10964);
    INSERT INTO     caln
    VALUES (To_Date('01/07/2010','mm/dd/yyyy'),2010,4,To_Date('01/07/2010','mm/dd/yyyy'),1,2010,7635,10965);
    INSERT INTO     caln
    VALUES (To_Date('01/08/2010','mm/dd/yyyy'),2010,5,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10966);
    INSERT INTO     caln
    VALUES (To_Date('01/09/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),1,2010,7636,10967);
    INSERT INTO     caln
    VALUES (To_Date('01/10/2010','mm/dd/yyyy'),2010,0,To_Date('01/08/2010','mm/dd/yyyy'),2,2010,7636,10968);
    INSERT INTO     caln
    VALUES (To_Date('01/11/2010','mm/dd/yyyy'),2010,6,To_Date('01/11/2010','mm/dd/yyyy'),2,2010,7637,10969);
    INSERT INTO     caln
    VALUES (To_Date('01/12/2010','mm/dd/yyyy'),2010,7,To_Date('01/12/2010','mm/dd/yyyy'),2,2010,7638,10970);
    INSERT INTO     caln
    VALUES (To_Date('01/13/2010','mm/dd/yyyy'),2010,8,To_Date('01/13/2010','mm/dd/yyyy'),2,2010,7639,10971);
    INSERT INTO     caln
    VALUES (To_Date('01/14/2010','mm/dd/yyyy'),2010,9,To_Date('01/14/2010','mm/dd/yyyy'),2,2010,7640,10972);
    INSERT INTO     caln
    VALUES (To_Date('01/15/2010','mm/dd/yyyy'),2010,10,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10973);
    INSERT INTO     caln
    VALUES (To_Date('01/16/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),2,2010,7641,10974);
    INSERT INTO     caln
    VALUES (To_Date('01/17/2010','mm/dd/yyyy'),2010,0,To_Date('01/15/2010','mm/dd/yyyy'),3,2010,7641,10975);
    INSERT INTO     caln
    VALUES (To_Date('01/18/2010','mm/dd/yyyy'),2010,11,To_Date('01/18/2010','mm/dd/yyyy'),3,2010,7642,10976);
    INSERT INTO     caln
    VALUES (To_Date('01/19/2010','mm/dd/yyyy'),2010,12,To_Date('01/19/2010','mm/dd/yyyy'),3,2010,7643,10977);
    INSERT INTO     caln
    VALUES (To_Date('01/20/2010','mm/dd/yyyy'),2010,13,To_Date('01/20/2010','mm/dd/yyyy'),3,2010,7644,10978);
    INSERT INTO     caln
    VALUES (To_Date('01/21/2010','mm/dd/yyyy'),2010,14,To_Date('01/21/2010','mm/dd/yyyy'),3,2010,7645,10979);
    INSERT INTO     caln
    VALUES (To_Date('01/22/2010','mm/dd/yyyy'),2010,15,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10980);
    INSERT INTO     caln
    VALUES (To_Date('01/23/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),3,2010,7646,10981);
    INSERT INTO     caln
    VALUES (To_Date('01/24/2010','mm/dd/yyyy'),2010,0,To_Date('01/22/2010','mm/dd/yyyy'),4,2010,7646,10982);
    INSERT INTO     caln
    VALUES (To_Date('01/25/2010','mm/dd/yyyy'),2010,16,To_Date('01/25/2010','mm/dd/yyyy'),4,2010,7647,10983);
    INSERT INTO     caln
    VALUES (To_Date('01/26/2010','mm/dd/yyyy'),2010,17,To_Date('01/26/2010','mm/dd/yyyy'),4,2010,7648,10984);
    INSERT INTO     caln
    VALUES (To_Date('01/27/2010','mm/dd/yyyy'),2010,18,To_Date('01/27/2010','mm/dd/yyyy'),4,2010,7649,10985);
    INSERT INTO     caln
    VALUES (To_Date('01/28/2010','mm/dd/yyyy'),2010,19,To_Date('01/28/2010','mm/dd/yyyy'),4,2010,7650,10986);
    INSERT INTO     caln
    VALUES (To_Date('01/29/2010','mm/dd/yyyy'),2010,20,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10987);
    INSERT INTO     caln
    VALUES (To_Date('01/30/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),4,2010,7651,10988);
    INSERT INTO     caln
    VALUES (To_Date('01/31/2010','mm/dd/yyyy'),2010,0,To_Date('01/29/2010','mm/dd/yyyy'),5,2010,7651,10989);
    INSERT INTO     caln
    VALUES (To_Date('02/01/2010','mm/dd/yyyy'),2010,21,To_Date('02/01/2010','mm/dd/yyyy'),5,2010,7652,10990);
    INSERT INTO     caln
    VALUES (To_Date('02/02/2010','mm/dd/yyyy'),2010,22,To_Date('02/02/2010','mm/dd/yyyy'),5,2010,7653,10991);
    INSERT INTO     caln
    VALUES (To_Date('02/03/2010','mm/dd/yyyy'),2010,23,To_Date('02/03/2010','mm/dd/yyyy'),5,2010,7654,10992);
    INSERT INTO     caln
    VALUES (To_Date('02/04/2010','mm/dd/yyyy'),2010,24,To_Date('02/04/2010','mm/dd/yyyy'),5,2010,7655,10993);
    INSERT INTO     caln
    VALUES (To_Date('02/05/2010','mm/dd/yyyy'),2010,25,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10994);
    INSERT INTO     caln
    VALUES (To_Date('02/06/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),5,2010,7656,10995);
    INSERT INTO     caln
    VALUES (To_Date('02/07/2010','mm/dd/yyyy'),2010,0,To_Date('02/05/2010','mm/dd/yyyy'),6,2010,7656,10996);
    INSERT INTO     caln
    VALUES (To_Date('02/08/2010','mm/dd/yyyy'),2010,26,To_Date('02/08/2010','mm/dd/yyyy'),6,2010,7657,10997);
    INSERT INTO     caln
    VALUES (To_Date('02/09/2010','mm/dd/yyyy'),2010,27,To_Date('02/09/2010','mm/dd/yyyy'),6,2010,7658,10998);
    INSERT INTO     caln
    VALUES (To_Date('02/10/2010','mm/dd/yyyy'),2010,28,To_Date('02/10/2010','mm/dd/yyyy'),6,2010,7659,10999);
    INSERT INTO     caln
    VALUES (To_Date('02/11/2010','mm/dd/yyyy'),2010,29,To_Date('02/11/2010','mm/dd/yyyy'),6,2010,7660,11000);
    INSERT INTO     caln
    VALUES (To_Date('02/12/2010','mm/dd/yyyy'),2010,30,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11001);
    INSERT INTO     caln
    VALUES (To_Date('02/13/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),6,2010,7661,11002);
    INSERT INTO     caln
    VALUES (To_Date('02/14/2010','mm/dd/yyyy'),2010,0,To_Date('02/12/2010','mm/dd/yyyy'),7,2010,7661,11003);
    INSERT INTO     caln
    VALUES (To_Date('02/15/2010','mm/dd/yyyy'),2010,31,To_Date('02/15/2010','mm/dd/yyyy'),7,2010,7662,11004);
    INSERT INTO     caln
    VALUES (To_Date('02/16/2010','mm/dd/yyyy'),2010,32,To_Date('02/16/2010','mm/dd/yyyy'),7,2010,7663,11005);
    INSERT INTO     caln
    VALUES (To_Date('02/17/2010','mm/dd/yyyy'),2010,33,To_Date('02/17/2010','mm/dd/yyyy'),7,2010,7664,11006);
    INSERT INTO     caln
    VALUES (To_Date('02/18/2010','mm/dd/yyyy'),2010,34,To_Date('02/18/2010','mm/dd/yyyy'),7,2010,7665,11007);
    INSERT INTO     caln
    VALUES (To_Date('02/19/2010','mm/dd/yyyy'),2010,35,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11008);
    INSERT INTO     caln
    VALUES (To_Date('02/20/2010','mm/dd/yyyy'),2010,0,To_Date('02/19/2010','mm/dd/yyyy'),7,2010,7666,11009);
    CREATE TABLE ords
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     ord_stat     VARCHAR2(2)
    ,     ord_qty          NUMBER
    ,     part_nbr     VARCHAR2(5)
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr)
    INSERT INTO     ords
    VALUES (1,1,'CL',10,'PART1');
    INSERT INTO     ords
    VALUES (1,2,'CL',5,'PART1');
    INSERT INTO     ords
    VALUES (25,1,'CL',15,'PART2');
    INSERT INTO     ords
    VALUES (14,1,'OP',12,'PART3');
    INSERT INTO     ords
    VALUES (33,1,'CL',25,'PART1');
    INSERT INTO     ords
    VALUES (33,2,'CL',15,'PART1');
    INSERT INTO     ords
    VALUES (33,3,'OP',10,'PART1');
    INSERT INTO     ords
    VALUES (7,1,'PL',18,'PART2');
    INSERT INTO     ords
    VALUES (96,1,'PL',10,'PART3');
    INSERT INTO     ords
    VALUES (31,1,'CL',20,'PART2');
    CREATE TABLE oops
    (     ord_nbr          NUMBER          NOT NULL
    ,     sub_nbr          NUMBER          NOT NULL
    ,     op_nbr          VARCHAR2(4)     NOT NULL
    ,     mach_id          VARCHAR2(4)
    ,     oper_stat     VARCHAR2(2)
    ,     plan_start_dt     DATE
    ,     plsu          NUMBER
    ,     plrn          NUMBER
         CONSTRAINT ords_pk PRIMARY KEY (ord_nbr, sub_nbr, op_nbr)
    -- NOTE:
    -- for the orders with a status of 'CL' or 'PL' in the 'ords' table, I'm not bothering to put
    -- in more than two operations (though in reality more would be there) since they should be
    -- ignored in the final result anyway
    INSERT INTO     oops
    VALUES (1,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (1,2,'0010','123A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (1,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (25,1,'0005','123A','CP',TO_DATE('01/18/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (25,1,'0030','110C','CL',TO_DATE('01/19/2010','mm/dd/yyyy'),4,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0010','127A','CP',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0025','110C','CL',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0040','050C','CP',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.15);
    INSERT INTO     oops
    VALUES (14,1,'0050','220B','WK',TO_DATE('01/14/2010','mm/dd/yyyy'),4,0.25);
    INSERT INTO     oops
    VALUES (14,1,'0065','242B','AV',TO_DATE('01/18/2010','mm/dd/yyyy'),1.5,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0067','150G','NA',TO_DATE('01/19/2010','mm/dd/yyyy'),2,0.1);
    INSERT INTO     oops
    VALUES (14,1,'0100','250G','NA',TO_DATE('01/20/2010','mm/dd/yyyy'),2.1,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,1,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,2,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,2,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0010','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (33,3,'0015','259B','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (33,3,'0020','220B','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1.7,0.15);
    INSERT INTO     oops
    VALUES (33,3,'0030','150G','NA',TO_DATE('01/13/2010','mm/dd/yyyy'),1.3,0.05);
    INSERT INTO     oops
    VALUES (33,3,'0055','150G','NA',TO_DATE('01/15/2010','mm/dd/yyyy'),2.1.,0.1);
    INSERT INTO     oops
    VALUES (7,1,'0005','123A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.2);
    INSERT INTO     oops
    VALUES (7,1,'0030','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.15);
    INSERT INTO     oops
    VALUES (96,1,'0010','127A','NA',TO_DATE('01/11/2010','mm/dd/yyyy'),2,0.25);
    INSERT INTO     oops
    VALUES (96,1,'0025','110C','NA',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    INSERT INTO     oops
    VALUES (31,1,'0005','123A','CL',TO_DATE('01/11/2010','mm/dd/yyyy'),1.9,0.2);
    INSERT INTO     oops
    VALUES (31,1,'0030','110C','CP',TO_DATE('01/12/2010','mm/dd/yyyy'),1,0.1);
    CREATE TABLE mach
    (     mach_id          VARCHAR2(4)     NOT NULL
    ,     desc_short     VARCHAR2(9)     
    ,     group          VARCHAR2(7)
         CONSTRAINT ords_pk PRIMARY KEY (mach_id)
    INSERT INTO     mach
    VALUES     ('123A','desc here','GROUPH1');
    INSERT INTO     mach
    VALUES     ('259B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('110C','desc here','GROUPJ1');
    INSERT INTO     mach
    VALUES     ('050C','desc here','GROUPK2');
    INSERT INTO     mach
    VALUES     ('220B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');
    INSERT INTO     mach
    VALUES     ('150G','desc here','GROUPL1');
    INSERT INTO     mach
    VALUES     ('250G','desc here','GROUPL2');
    INSERT INTO     mach
    VALUES     ('242B','desc here','GROUPH2');

  • Workday calculation for specified date range

    Hi All,
    How to count number of workdays available for given date range. And I tried below statement which is
    not working.
    SUM(CASE [Calendar].[Calendar Date]
        WHEN [Calendar].[Calendar Date].[Year] = '2005' AND [Calendar].[Calendar Date].[Month]
    = 1
        THEN [Calendar].[Calendar Date].CURRENTMEMBER.CHILDREN
        END
    , [Measures].[Work Day Flag])

    Hi bpbhhaskar,
    According to your description, you want to count the weekdays in MDX. Right?
    In this scenario, we can just aggregation days from Monday to Friday. The key should be 2 to 6. Please use the expression below:
    with
    MEMBER [Measures].[DayCount] AS
    Count
    Descendants
    [Date].[Calender].CurrentMember
    ,[Date].[Calender].[Date]
    * {[Date].[Day Of Week].&[2]:[Date].[Day Of Week].&[6]}
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Functions in Calculation and Summary Fields

    Hi,
    I'll give a bit of background to my situation before describing the advice I'm looking for here.
    I am experienced Mac user and I have used AW a fair bit in the past, but since I've been working in a job which has Windows machines and uses a complex custom-written relational database for its main tool, I use it less often than I did, so I am a little rusty. It is the shortcomings of the complex relational database (which I do not have admin rights to) that has led me back to AW and its database module.
    Essentially, I am a complaints investigator, and the relational database provided by my employer is used to keep track of correspondence and various metadata associated with the investigation of the complaint. However, although it is called a Complaints Management System (CMS), it does not help me manage my caseload very well. I've previously tried to create an Excel spreadsheet that would help me manage my work, but it is not a database (or I am not sufficiently skilled with Excel) and I cannot get it to provide me with what I want.
    So, my problems.
    I have complaints (cases) assigned to me to investigate. These cases have differing priorities, which means differing time limits for completion of the investigation. The priorities and time limits are set out below:
    J (jurisdictional issues) - time limit = 1 month
    D (discretion not to investigate) - time limit = 3 months
    1 - time limit = 4 months
    2 - time limit = 6 months
    3 - time limit = 12 months
    The priority field in my AW DB is currently a 'pop-up menu' field, but I could change this to another type if this would be advisable.
    I have a date-type field in which I enter the date the complaint was received. I have an calculation-type field in which I calculate the age of the complaint using the function:
    =(NOW()-'DateReceived')
    This returns an age in days, which I input into a separate calculation field that divides the result of 'age in days' by 30, to give a rough approximation of the number of months old the complaint is (If AW has an equivalent to Excel's 'workdays' variable, I'd love to hear about it). This latter field is the one that I display in the main data entry view of the database.
    Given the priority assigned to the complaint, and the age of it, I am either 'On Target' or 'Over Target' for completing the investigation.
    Each month I have a meeting with my manager to review progress, and since the reports that can be extracted from the CMS are not very useful for this purpose, I want my AW database to help me generate reports that can form the basis of discussion in these meetings.
    Part A of My Query
    At present, I have a manually operated field, in the form of a pop-up menu, to indicate for each record (complaint) whether I am over or on target for completion of the investigation. I would like to make this a calculated field, so that the database keeps track of this for me automatically. Unfortunately, I'm either too dense, or not good enough with the syntax of AW functions, to be able to write a function which essentially does the following:
    IF 'Priority'=1 AND 'Age in Months'<4 THEN 'On Target' ELSE 'Over Target'
    - and then repeats that for the other priority possibilities.  It seems likely that the 'IF' function is what I'm after, but I haven't been able to get the syntax right to combine 'Priority' and 'Age in Months' in the format spelt out in the AW help, which is:
    =IF(logical,true value,false value)
    Getting the syntax of one part of this function right would be a good start. However, I suspect that I have a larger problem, in that I have 5 priorities to measure against and I need the overall calculation (that produces the 'On Target' or 'Over Target' results) to report in one result field. This means nesting the functions that look at the 5 priorities and 5 age limits. I've tried and failed to get the syntax of such nesting right, so advice on this is doubly welcome.
    Unfortunately, I have a sneaking suspicion that unless the answer is much more concise than I imagine it to be, there will be an additional problem: AW appears to have a character limit for the length of a function string in a calculation field which may be too short for my needs.  If you think this is an issue but that it can be solved through the use of intermediate fields (which don't need to be displayed in the main 'data entry' layout), I'm happy to give that a shot.
    Part B of my Query
    Even if the problem above cannot be solved, and I have to manually enter whether a complaint is 'On Target' or 'Over Target', I have a separate but related question for the reports I have to present to my manager.
    On these reports, I would like to have a summary at the top of the first page (in a grand-summary part, I assume) which gives a count of how many complaints are 'On Target' or 'Over Target' for each priority. Below that is a sub-summary part, ordered by the type of action that must next be taken in the investigation. (Getting that right may be a subject of a separate post at a later date.) The report must, of course, only report on those complaints that are still being investigated ('open complaints') and not those which have been completed ('closed complaints'). So, I need a function in a summary field which will present an accurate count of the number of open complaints that are 'on target' for priority J (with separate summary fields that do the same thing for priorities D, 1, 2, and 3), and a separate set of summary fields that will present a count of open complaints that are 'over target' for each type of priority.
    It might look a bit like this table below, with figures from the summary fields populating the cells in the third row:
    Priority
    J
    D
    1
    2
    3
    In / Out of Target
    In
    Out
    In
    Out
    In
    Out
    In
    Out
    In
    Out
    Number of Complaints
    My guess is that it is easier to have the summary field simply count all the complaints that are on or over target for a given priority, regardless of whether they are open or closed, since the report could be based on a saved search (match) which strips out all closed complaints. But if I'm off-beam with that idea, I'm happy to have another way of cracking this nut.
    Many thanks in advance to any Community members that take the time to try and help me with this.
    Andrew
    PS Cross posted in AWUG forum too, if people prefer to answer there.

    Hi Andrew,
    Part A:
    I've done some restating of the question, and distributed the calculations among several fields, not all of which need to be included on the visible layout. Other than formatting the Date fields and moving the 'Completed Date' field and its label, I've left this in the default "Layout 1" produced by AppleWorks.
    Field List:
    Priority: Popup menu with six items: 00, J, D, 1, 2, 3  Defaults to 00
    TL (time limit in months): Calculation:  CHOOSE('Priority',0,1,3,4,6,12)
    Received: Date. Option: Automatically insert today's date (ie. Date Record created) (may be edited)
    Target Date: Calculation:
    DATE(YEAR('Received')+INT(MONTH('Received')+'TL')/12,MOD(MONTH('Received')+'TL', 12),DAY('Received'))
    Remaining (Days): Calculation: INT('Target Date'+1-NOW())  (see revision below)
    Completed: Checkbox. Set default value to Unchecked.
    Completed Date: Date: Entered manually
    OnTarget: Calculation: IF('Completed',IF('Completed Date'<'Target Date',"On Target","Over"),IF(INT(NOW())>'Target Date',"Over","On Target"))
    The On Target field shows the current status of the case while still open, and the state on the closing date when it was closed.
    Having done that, I was unhappy with the Remaining field continuing to calculate an ever larger negative number after the case had been closed. Hence this revision below:
    Remaining: Calculation: IF('Completed','Target Date'-'Completed Date',INT('Target Date'+1-NOW()))
    Shows the number of days remaining while the case is open, the days remaining at completion if the case has been marked Completed and the completion date entered.
    Rsults (and some further formatting of the Layout) below.
    Part B:
    You will need Subsummary parts when sorted on Completed and on On Target. Fields can appear on  a Layout only once, so each subsummary part will need a separate Summary type field for each field to be summarized.
    Regards,
    Barry

  • How to WorkDay() Excel Function in Business Objects Web Intelligence 12.2.7

    Hi,
    I am calculating OTD SLA metrics using the Business Object Web Intelligence, but I am stuck with the WorkDay() how to use this in BO, as it is available in Excel.  Requirement is that I need to add business days (Saturdays and Sundays should not be considered) to a particular date. Greatly appreciate if some one can help me immediately as this is high priority right now and need to complete it <REMOVED_BY_MODERATOR>. Thank you, Shiv.   Thanks in advance.
    Edited by: Pravender on Nov 22, 2010 11:18 AM

    Thank you for trying to reply.
    What exactly I need is that:
    Example:
    11/19/2010  +  3  this should give me the date 11/24/2010 which is actually  excluding Sat and Sun and adding only the business days to the date.
    Please provide me full formula
    Thanks in advance, Shiv

  • Schedule Line Delivery Date Calculation with Transportation Scheduling

    Hi All,
    We are currently running into a problem where our Sales Order Schedule Line delivery dates are being pushed out too far into the future - because of the Calendar being used to determine the transit time.
    We have 'Delivery Scheduling' and 'Transportation Scheduling' activated for our Sales Document type
    We have Routes that are configured with a 'Transit Time' and a 'Factory Calendar'
    Order Scenario:
    'Factory Calendar' assigned to our 'Route' is setup with only one 'Workday' in a given week e.g. Wednesday
    Our 'Route' has a Transit Time of 2 days
    We create a Sales Order on Monday for a Material that is available in our Plant
    The 'Goods Issue' date is being determined correctly for the next Workday - being Wednesday
    The 'Delivery Date' is extending out over 15 days (2 Wednesdays into the future) - since it is working on 'Calendar Days' and not 'Actual Days'
    Does anyone know of a way (config or other) to only influence the 'Goods Issue' date with the 'Factory Calendar' assigned to the Route, and have the 'Delivery Date' calculated using the Transit Time on the Route and 'Actual Days' rather than Calendar days?
    All help greatly appreciated.
    Thanks,
    Ravelle<i></i>

    Hi Pathik,
    Thanks for your reply.  I have already maintained the Calendars I'm using for this business process in <SCAL> - same as <OY05>. 
    The problem I'm having though is that by assigning a Calendar directly to my route (which I doing to influence the goods issue date - using a 1 Working Day Calendar) it is also taking precedence in determining the Transit time - which in this case I don't want, as I want my Transit time to be determined using a 5 Working Day Calendar.
    I don't think this problem has a config option as a work around...I think the only possibility in this case is a development to achieve the results we need.
    Thanks,
    Ravelle

  • Lag function not working in calculated measure

    I am facing a strange problem while using "Lag" function in calculated measure.
    I have a time dimension which consists of date, workday, financial week, Financial Month and Financial Year.
    The concept of workday is its a integer number which represents date. In case of holidays this number donot change and remain constatnt till next working day. 
    Here workday no remains 460 as 20120708 is a holiday.27 and 28 denotes FinancialWeek.
    Now basically I want to find previous wokdays count.
    with member [Measures].[Prev Count]
    AS
    sum(
              existing [Date].[Workdayno].[Workdayno].Members,
     ([Date].[Workdayno].lag(1),[Measures].[Fact Count]))
    Select { [Measures].[Prev Count]} on 0,
    {[Date].[Calendar].Members} on 1 from [My Cube]
    Where([Date].[Calendar].&[20120709])
    What I expect that It will give me sum of counts where wokday no is 460.
    But its showing null value.
    with member [Measures].[PrevCount]
    As
    SUM(EXISTING [Processing Date].[Workday].[Workday].MEMBERS,([Processing Date].[Workday].LAG(1),[Measures].[Sequenced Records]))
    SELECT {[Measures].[PrevCount]} ON 0 FROM --[E2Eitem]
    WHERE([Processing Date].[E2E Calendar].[Date].&[20120709])
    It looks like existing function is failing to exist the member related to date??
    Any suggestion.

    Try using
    with member [Measures].[Prev Count]
    AS
    sum(
              existing [Date].[Workdayno].[Workdayno].Members,
     ([Date].[Workdayno].currentmember.lag(1),[Measures].[Fact Count]))
    Victor Rocca

  • Stock Coverage Calculation

    Hello
    I would like to know if an essbase function calculation to calculate month stock coverage exists in Essbase ?
    I know this type of function on other system:  SAP (SNP) but nothing in Essbase in my knowledge
    COVER_CALC()
    COVER_CALC(rows for stock on hand ; area for demand from the next period to the end of the time period ; area containing the number of workdays ; demand from the next period to the end of the time period) returns the days’ supply of a product by considering the current stock on hand, the total demand of subsequent time periods, and the number of workdays in this time period.
    For example:
    Time span  w11  w12  w13  m04  m05
    Total demand:  0  20,0  0  25,0  27,5
    Stock level  68,7  48,7  48,7  23,7  0
    Days’ supply  70  63  57  26  0
    Workdays  7  7  7  30  31
    Result at the end of m04:
    Total demand is 23.7
    Total demand in the future is 27.5
    Total number of work days in the next period is 31.
    Thus, (23.7/27.5) x 31  ~ 26 (only 26 days can be covered)
    Using the above value (26)
    for w12: Days’ supply is 63 = 7 (from w13) + 30 (from m04) + 26 (from m05).
    for w11: Days’ supply is 70 = 7 (from w12) + 30 (from m13) + 26 (from m04) + 26 (from m05).
    THanks of your help
    Regards

    There is no built-in function to do this calculation, although since you have the logic defined (and can see that it's fairly straightforward) you can build it yourself.  I added "Days of Supply" to a sales analysis system I maintain recently.

  • Auto Calculation of Calendar and absence day on 2001 screen.

    dear gurus
    I have half day absent type Z108, subtype of 2001.
    i want to default calender days on 2001 screen.
    I mean, when user select to create Half day leave/absent on 2001 and subtype z108,
    calendar day and absence should be calculated 0.5 automatically.
    I have worked with T554L,V_554S_G,V_T554E,V_T554C,T556 but didnt work
    at this moment, I am getting this on 2001 screen
    Absence hours                8,00
    Absence days                 1,00
    Calendar days                1,00
    when select Z108.
    I want above 3 as
    Absence hours                4,00
    Absence days                 0,50
    Calendar days                0,50
    kindly help in this scenario.

    Hi Monam,
    Can yuou check the view V_T554S for your absence type.
    The minimum duration and maximum duration in 'Input Chceks' Box should be '000' and '999'.
    Minimum duration in days                                                                               
    The Minimum duration in days defines the minimum permitted duration of
        an attendance or absence.                                                                               
    Attendances and absences that are allowed to last for less than one   
        workday are assigned the indicator 000. Attendances and absences that 
        are to be rejected by the system if they are shorter than one day are 
        denoted by an indicator greater than or equal to 001.                                                                               
    Dependencies                                                                               
    In the Unit field, you determine which of the three durations in days 
        should be used for the validation.                                    
    Thanks & Regards, Swapnil Mishra

  • Calculating Work Day Formulas

    We've recently adopted BOBJ/Webi at my company and I find the software to be rather easy to use in some instances and mind-wreckingly hard in others. One roadblock myself and other users are bumping into is calculating work days. A definition of a work day in this instance would be Monday through Friday. The monkey wrench is that we would also like to subtract out holidays, such as July 4th and Thanksgiving. Then end product would be calculating out what work day the current date is and how many days it is out of so that a simple straight-line extrapolation can be made (Metric/Current Work Day)*Total Work Days. Also, what we invoice/ship is not accounted for until the following day... for example, today (2.22.10) would be the 15th workday in February out of 20 total work days.
    Appreciate any and all help/assistance/counsel I can get on this.
    Ryan

    Hi Ryan,
    If I have understood your question then I think following solution may help you.
    Do you have your Universe created on the top of BW query or is it some other Database?
    If it is some other database then create couple of Filter at Universe level: Such as Holidays so that you can use this one to subtract holidays:
    For Example:
    ucase(Calendar_year_lookup.Holiday_Flag)
    ucase(Calendar_year_lookup.Holiday_Flag) = 'Y'
    Then you create another Dimension for Work days that would be between Monday to Friday.
    Once they are created in Universe you export Universe.
    Now create a formula where you would use month minus custom dimension workdays and minus holidays to get actual work days which would be from Monday to Friday and son on.
    Basically we can achieve this by using filters and formulas.
    Wish you good luck.
    Bashir Awan

  • Tax Calculation of free goods

    Hi
    We have a requirement where the client wants only VAT to be posted in GL accounts and not the price.For this I tried free goods condition type R100 with AltCBV 28.But the VAT value is also coming zero. I want the VAT to be calculated on Pricing condition and then give 100% discount.
    Apart from this I also tried to make pricing condition statistical and calculate VAT on it but then also system gives zero value for VAT.
    Also wondering if the scenario can be addressed with Free of Change Dellivery.

    Hi
    Normally in scenario where you are dealing with samples , there are cases you have to charge only TAXES / EXCISE part.
    Here my SUGGESTION is you can handle this through a simple sales order process, where you have to configure a new pricing procedure.
    1. Create a new document type to handle samples.
    2. Create a New pricing procedure where you can keep the basic price condtion as Statistical and rest all same as wht is is there your main pricing procedure. Just juggle with the TO-FROM to capture the TAX part in the total.
    3. Doc pricing procedure will help you to pick the new Pricing procedure
    4. Now Process this as a normal sales order
    5. This new document type will help you to have a proper reporting.
    The only constraint here is USER has to punch a fresh order seperately for such scenario. He cannot give a free good in the same sales order which is used as standard.
    The other way is you can configure a FREE GOOD Determination procedure as suggested  where you need to then have your Single pricing procedure accomodating the same scenario.
    Thanks
    RB

  • IF statement in Calculated Field for Share point, doesnt calculate sum in my Excel Pivot table.

    Hi Everyone
    I used this in SP calculated column field.
    =IF([Shift Sched]="1pm to 10pm","0",IF([Shift Sched]="2pm to 11pm","1",IF([Shift Sched]="3pm to 12am","2",IF([Shift Sched]="4pm to 1am","3",IF([Shift Sched]="5pm to 2am","4",IF([Shift
    Sched]="6pm to 3am","5",IF([Shift Sched]="7pm to 4am","6",IF([Shift Sched]="8pm to 5am","7",IF([Shift Sched]="9pm to 6am","8",IF([Shift Sched]="10pm to 7am","8",IF([Shift
    Sched]="11pm to 8am","7",IF([Shift Sched]="12pm to 9am","6",IF([Shift Sched]="1am to 10am","5",IF([Shift Sched]="2am to 11am","4",IF([Shift Sched]="3am to 12pm","3",IF([Shift
    Sched]="4am to 1pm","2",IF([Shift Sched]="5am to 2pm","1",IF([Shift Sched]="6am to 3pm","0",IF([Shift Sched]="7am to 4pm","0",IF([Shift Sched]="8am to 5pm","0",IF([Shift
    Sched]="9am to 6pm","0",IF([Shift Sched]="10am to 7pm","0",IF([Shift Sched]="11am to 8pm","0",IF([Shift Sched]="12pm to 9pm","0"))))))))))))))))))))))))    
    it was able to work fine however my issue is when i extract the information to excel and use a pivot table the table is not able to calulate the sum of the value for this field. Can you please help me with this. this is for an Attendance traker for Night
    Differential pay for employees. they create a daily log of their shift schedule and if i summarize this in pivot the value in the calculated field for this is not getting the sum.
    Thanks,
    Norman

    Hi Everyone
    I used this in SP calculated column field.
    =IF([Shift Sched]="1pm to 10pm","0",IF([Shift Sched]="2pm to 11pm","1",IF([Shift Sched]="3pm to 12am","2",IF([Shift Sched]="4pm to 1am","3",IF([Shift Sched]="5pm to 2am","4",IF([Shift
    Sched]="6pm to 3am","5",IF([Shift Sched]="7pm to 4am","6",IF([Shift Sched]="8pm to 5am","7",IF([Shift Sched]="9pm to 6am","8",IF([Shift Sched]="10pm to 7am","8",IF([Shift
    Sched]="11pm to 8am","7",IF([Shift Sched]="12pm to 9am","6",IF([Shift Sched]="1am to 10am","5",IF([Shift Sched]="2am to 11am","4",IF([Shift Sched]="3am to 12pm","3",IF([Shift
    Sched]="4am to 1pm","2",IF([Shift Sched]="5am to 2pm","1",IF([Shift Sched]="6am to 3pm","0",IF([Shift Sched]="7am to 4pm","0",IF([Shift Sched]="8am to 5pm","0",IF([Shift
    Sched]="9am to 6pm","0",IF([Shift Sched]="10am to 7pm","0",IF([Shift Sched]="11am to 8pm","0",IF([Shift Sched]="12pm to 9pm","0"))))))))))))))))))))))))    
    it was able to work fine however my issue is when i extract the information to excel and use a pivot table the table is not able to calulate the sum of the value for this field. Can you please help me with this. this is for an Attendance traker for Night
    Differential pay for employees. they create a daily log of their shift schedule and if i summarize this in pivot the value in the calculated field for this is not getting the sum.
    Thanks,
    Norman

  • If statement in Custom Calculation Script

    I have 16 fields and if even one of them ="1" I have to list it in another field.  I do not want to count or sum.  If one of those fields has a 1 in it I just want the other field to display Y and if none have a 1 I want that field to display N.
    Please help.
    Thank you in advance~mjc

    You need to write a compound logical statement to evaluate all of the values and that statement needs to evaluate to true or false.
    Do you know how to write JavaScript?
    Do you know how to enter JavaScript calculations into a form field?
    For custom calculation of the text field I could write something like:
    // define an array of the field names to check
    var aNames = new Array("Text1", "Text2", "Text3", "Text4",
    "Text5", "Text6", "Text7", "Text8",
    "Text9", "Text10", "Text11", "Text12",
    "Text13", "Text14", "Text15", "Text16");
    // define a logical variable that is true if any field has a value of 1 - default is false or no field has a value of 1
    var bMatch = false;
    // value for text field
    var TextValue = 0;
    // logical value of field being equal to 1 test
    var FieldIs1 = false;
    // loop through all the fields and test the fields value
    for(i = 0; i < aNames.length; i++) {
    // logically OR the result of field i value equal to true with bMatch
    // get the value of field
    TextValue = this.getField( aNames[i] ).value;
    // test the value of the field
    FieldIs1 = Number(TextValue) == 1
    // logically OR the 2 values
    bMatch = FieldIs1 | bMatch;
    } // end field processing
    // set the field value
    if(bMatch == true) {
    event.value = "Y";
    } else {
    event.value = "N";
    You will need to change the field names to match your fields. You can add more field name or remove field names as needed and the script will adjust for the number of field names.

  • If statement in calculated batch characteristic (dependencies)

    I have a little problem with calculating a certain batch characteristic.
    The situation is the following:
    I have batch char A, batch char B and batch char C. Batch char C is the result of the sommation of char A and B. The problem I have now is that batch char C only should be calculated when batch char A and B are different from 0.
    I have a custom build interface that imports QM data to the batch chars. Default, all my batch chars are set to 0 so if I just say $self.charC = $self.charA + $self.charB, I always get a value.
    Is it possible to some sort of IF statement to check if the value is different from 0?

    Dear,
    You need to try with variant table
    take all the combination and enter in a variant table and see the result...it works
    example
    A     B      C
    0      0      space
    0      1      sapce
    1      1      space
    I hope you got it

Maybe you are looking for

  • ADF/BC Swing  PasswordChangeDialog

    Hello, is there an easy way to create a Password Change Dialog for Database Users? ak

  • Bypass proxy for FQDN with private ip addresses

    We have Windows 7 with IE 11 We need this IE behavior: "to all FQDN names that resolves to local (private) ip addresses - do not use proxy." how can we implement this? ("Bypass Proxy Server for Local Addresses" Option don't work as needed)

  • Rdisp/mssserv is not set in Java add in installation

    I am in the process of trying to install the Java add-in to the already upgraded WAS ABAP server.  After specifying the location of the profile directory, I continue to get an error message that reads, "Profile parameter rdisp/msserv_internal in not

  • Unknown Machines and NAP

    Hi all, The company I work for is having a major network upgrade including the replacement of all edge and core switches.  Part of this upgrade will be the introduction of NAP.  We have just had two new 2012 r2 servers installed running NAP. During o

  • Too many emails associated with product

    My daughter recently got an ipod touch. She has signed onto itunes using my account. Now she wants her own acct on the ipod touch so she can use facetime and all that stuff, but for some reason it is affecting my iphone. She has put 2 different email