How to perform a self-join in WebI?

Post Author: willgreenland
CA Forum: WebIntelligence Reporting
I want to perform a self-join on a table in WebI, in order to achieve the following result (of course, if there is another way of doing this I'd be glad to hear it):
I have a table that lists the department in which an employee is located at given dates in the past:
EMPLID    DEPT    DATE
123                Sales    2007...
  I want to use this table to track migration between departments, in other words I want to produce the following output table, showing how in 2008, 5 employees moved from Sales to Marketing (etc):DEPT_A    DATE_A    DEPT_B    DATE_B    COUNT(EMPLID) Sales        2007          Mrkting      2008             5...
In order to do this in SQL, I would do the following:
SELECT a.DEPT, b.DEPT, count(distinct EMPLID)FROMEMPL_DEPT a, EMPL_DEPT b        // note the self-join hereWHERE( a.EMPLID = b.EMPLID AND a.DATE = '2007' AND b.DATE = '2008' )GROUP BY a.DEPT, b.DEPT;
Is there a way of doing this in WebI, ideally without resorting to manual SQL editing (I want this to be a report that other users can make sense of without necessarily getting into the SQL)?

Post Author: amr_foci
CA Forum: WebIntelligence Reporting
you cant do something like that in the WebI directly, you have to manager that at the unvinerse level first
good luck

Similar Messages

  • Performance Tuning - Self Join Issue

    Hi,
    The following query takes long time to execute. Is there any better way to
    re-writing the query to reduce the time it takes to execute.
    INSERT INTO TT_TEMP_MAINGUI_SP_PERCENT_MOV
    (prev_prc_dt,asset_id,pricing_pt_id,price_dt)
    SELECT max(tpm2.prc_dt),
    tpm2.asset_id ,
    tpm2.pricing_pt_id ,
    tpm1.prc_dt
    FROM t_prc_master tpm1,
    t_prc_master tpm2
    WHERE tpm1.prc_dt = '19-Dec-07'
    AND tpm1.asset_id = tpm2.asset_id
    AND tpm1.pricing_pt_id = tpm2.pricing_pt_id
    AND tpm2.prc_dt < tpm1.prc_dt
    AND tpm2.accept_flg = 'Y'
    AND tpm1.accept_flg = 'Y'
    AND EXISTS (SELECT 1 FROM t_temp_prcmov
    WHERE pca_flg = 'P'
    AND tpm1.pricing_pt_id = prc_pt_cntry_atyp)
    GROUP BY tpm2.asset_id, tpm2.pricing_pt_id,tpm1.prc_dt;
    select count(*) from t_prc_master
    where prc_dt = '19-Dec-07'
    COUNT(*)
    784161
    -- Here is the TKPROF Output
    INSERT INTO TT_TEMP_MAINGUI_SP_PERCENT_MOV
    (prev_prc_dt,asset_id,pricing_pt_id,price_dt)
    SELECT max(tpm2.prc_dt),
    tpm2.asset_id ,
    tpm2.pricing_pt_id ,
    tpm1.prc_dt
    FROM t_prc_master tpm1,
    t_prc_master tpm2
    WHERE tpm1.prc_dt = '19-Dec-07'
    AND tpm1.asset_id = tpm2.asset_id
    AND tpm1.pricing_pt_id = tpm2.pricing_pt_id
    AND tpm2.prc_dt < tpm1.prc_dt
    AND tpm2.accept_flg = 'Y'
    AND tpm1.accept_flg = 'Y'
    AND EXISTS (SELECT 1 FROM t_temp_prcmov
    WHERE pca_flg = 'P'
    AND tpm1.pricing_pt_id = prc_pt_cntry_atyp)
    GROUP BY tpm2.asset_id, tpm2.pricing_pt_id,tpm1.prc_dt
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 226.01 317.50 1980173 4915655 805927 780544
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 226.01 317.51 1980173 4915655 805927 780544
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 98 (PRSDBO)
    Rows Row Source Operation
    780544 SORT GROUP BY (cr=4915236 r=1980165 w=0 time=312751120 us)
    40416453 NESTED LOOPS (cr=4915236 r=1980165 w=0 time=245408132 us)
    783459 NESTED LOOPS (cr=956325 r=92781 w=0 time=17974163 us)
    55 TABLE ACCESS FULL T_TEMP_PRCMOV (cr=3 r=0 w=0 time=406 us)
    783459 TABLE ACCESS BY INDEX ROWID T_PRC_MASTER (cr=956322 r=92781 w=0 time=17782856 us)
    784161 INDEX RANGE SCAN PRC_DT_ASSET_ID (cr=412062 r=69776 w=0 time=14136725 us)(object id 450059)
    40416453 INDEX RANGE SCAN ASSET_DT_ACCEPT_FLG (cr=3958911 r=1887384 w=0 time=217215303 us)(object id 450055)
    Rows Execution Plan
    0 INSERT STATEMENT GOAL: CHOOSE
    780544 SORT (GROUP BY)
    40416453 NESTED LOOPS
    783459 NESTED LOOPS
    55 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'T_TEMP_PRCMOV'
    783459 TABLE ACCESS GOAL: ANALYZED (BY INDEX ROWID) OF
    'T_PRC_MASTER'
    784161 INDEX GOAL: ANALYZED (RANGE SCAN) OF 'PRC_DT_ASSET_ID'
    (NON-UNIQUE)
    40416453 INDEX GOAL: ANALYZED (RANGE SCAN) OF 'ASSET_DT_ACCEPT_FLG'
    (UNIQUE)
    Could somebody help me in resolving the issue? It would be appreciated...

    Well, it's a bit of a mess to read. Please use the pre or code tags enclosed in [] next time to preserve the formatting of the code.
    First thing that looks 'bad' to me is
    WHERE tpm1.prc_dt = '19-Dec-07'which should be (i assume you want 2007 and not 1907)
    WHERE tpm1.prc_dt = TO_DATE('19-Dec-2007', 'DD-MON-YYYY');The next thing i'm very confused with is...why are you self joining the table? You should be able to just do this.....logically, it should produce the same results, though it's obviously not tested :D)
    SELECT
       max(tpm2.prc_dt),
       tpm2.asset_id ,
       tpm2.pricing_pt_id ,
       TO_DATE('19-Dec-2007', 'DD-MON-YYYY')  AS prc_dt
    FROM t_prc_master tpm2
    WHERE tpm2.prc_dt < TO_DATE('19-Dec-2007', 'DD-MON-YYYY')
    AND   tpm2.accept_flg = 'Y'
    AND   EXISTS   ( 
                      SELECT
                         NULL
                      FROM t_prc_master tpm1
                      WHERE tpm1.prc_dt          = TO_DATE('19-Dec-2007', 'DD-MON-YYYY')
                      AND   tpm1.asset_id        = tpm2.asset_id
                      AND   tpm1.pricing_pt_id   = tpm2.pricing_pt_id
                      AND   tpm1.accept_flg      = 'Y'                 
                      AND   tpm1.pricing_pt_id  IN (SELECT tmov.prc_pt_cntry_atyp FROM t_temp_prcmov tmov WHERE tmov.pca_flg = 'P')
    GROUP BY tpm2.asset_id, tpm2.pricing_pt_id, TO_DATE('19-Dec-2007', 'DD-MON-YYYY');Message was edited by:
    Tubby

  • How to resolve Self Joins in OBIEE

    Hi All
    Could any one help how to resolve the Self Join relations in OBIEE (ex. "SCOTT.EMP" table has "EMPNO" column which is referenced by "MGR" column in the same table.
    Request:
    Need to drill down from the Top manager to his employees and so on
    Another example can be applied for reporting the Organisation Chart

    This is a great article that shows ho to do the Alias:
    Adding an Alias table within the BI physical layer using Oracle BI Administration Tool
    http://www.mandsconsulting.com/adding-an-alias-table-within-oracle-bi-administration-tool
    Thanks
    Subra

  • Self join using ABAP Query

    Hello all,
    How to create a self join using ABAP Query?
    Say, I have this table EKBE with belnr (materials doc num) and lfbnr (reference material doc num). I have to pick the PO's from EKBE whose belnr doesnt have any lfbnr.
    Regards
    Madhumathi A

    hi madhu,
    tables : ekbe.
    data itab like standard table of ekbe with header line.
    select * from ekbe into table itab where belnr >< 0 and lfbnr = ' '.
    loop at itab.
    write :/ itab-belnr,itab-lfbnr.
    endloop.
    check this code this works to select the orders whose belnr doesnt have any lfbnr
    reward points if useful.

  • How to achieve parent-child relationship using self join?

    my table structure is as follows
    parent child name
    -1     1     A1
    1     2     A2
    1     3     A3
    how to achieve the hierarchy model using self join. this can be easily achieved using "connect by prior". but how to achieve the same using self join?

    Hi,
    Yes, that's definitely possible. If you only need to display two levels from the hierarchy, a self-join is a good option. Make it an outer join if you need to show everyone on one level, regardless of whether they have a match on the other level or not; for example, if you want the output:
    child_name     child_id     parent_name     parent_id
    A1          1
    A2          2          A1          1
    A3          3          A1          1It's good that you posted some sample data. Now post the results you want from that data, and your query (what you think is the best attempt you've made so far). If you haven't tried anything so far, then look at some other simple self-join to get ideas.

  • Inner Join. How to improve the performance of inner join query

    Inner Join. How to improve the performance of inner join query.
    Query is :
    select f1~ablbelnr
             f1~gernr
             f1~equnr
             f1~zwnummer
             f1~adat
             f1~atim
             f1~v_zwstand
             f1~n_zwstand
             f1~aktiv
             f1~adatsoll
             f1~pruefzahl
             f1~ablstat
             f1~pruefpkt
             f1~popcode
             f1~erdat
             f1~istablart
             f2~anlage
             f2~ablesgr
             f2~abrdats
             f2~ableinh
                from eabl as f1
                inner join eablg as f2
                on f1ablbelnr = f2ablbelnr
                into corresponding fields of table it_list
                where f1~ablstat in s_mrstat
                %_HINTS ORACLE 'USE_NL (T_00 T_01) index(T_01 "EABLG~0")'.
    I wanted to modify the query, since its taking lot of time to load the data.
    Please suggest : -
    Treat this is very urgent.

    Hi Shyamal,
    In your program , you are using "into corresponding fields of ".
    Try not to use this addition in your select query.
    Instead, just use "into table it_list".
    As an example,
    Just give a normal query using "into corresponding fields of" in a program. Now go to se30 ( Runtime analysis), and give the program name and execute it .
    Now if you click on Analyze button , you can see, the analysis given for the query.The one given in "Red" line informs you that you need to find for alternate methods.
    On the other hand, if you are using "into table itab", it will give you an entirely different analysis.
    So try not to give "into corresponding fields" in your query.
    Regards,
    SP.

  • How to re-write this self join update using a CTE

    I would like to improve my performance on this update statement and would like to try re-writing using a CTE:
    UPDATE "usr_sessions" "a" SET "is_ended_at_trustable" = 't'
          WHERE (
            EXISTS (
              SELECT 1
              FROM "usr_sessions" "b"
              WHERE "a"."ended_at" = "b"."started_at"
                AND "a"."usr_space_id" = "b"."usr_space_id"
                AND "a"."account_id" = "b"."account_id"
          ) ) AND "a"."is_ended_at_trustable" IS NULL
    Any help is greatly appreciated!  Open to other suggestions as well if there is a better way!

    If I understood your description correctly, here's a way to accomplish the same thing, while dodging the need for the self join.   The update itself won't be any faster, but the overall query leading to the update will likely be faster sans self-join.
      (If my interpretation wasn't exactly what you meant, tweak the "partition by" clause).
    MERGE is generally considered better then UPDATE, but your particular update isn't at risk for the shortcomings of update (still, Merge is newer, cooler, and more trustworthy).
    Setup_Example_Data:
    Declare @Usr_Sessions table (account_id int, usr_space_id int, is_ended_at_Trustable Char(1), started_at varchar(99), ended_at varchar(99))
    Insert @Usr_Sessions
    Select 1, 10, 't', 'A1', 'A1'
    UNION ALL Select 2, 20, 'f', 'B1', 'B2'
    UNION ALL Select 3, 30, NULL, 'C1', 'C1'
    UNION ALL Select 4, 40, NULL, 'D1', 'D2'
    UNION ALL Select 5, 50, NULL, 'E1', 'E2'
    UNION ALL Select 5, 51, NULL, 'E3', 'E3'
    UNION ALL Select 6, 61, NULL, 'F1', 'F2'
    UNION ALL Select 6, 62, 't', 'F3', 'F3'
    UNION ALL Select 6, 62, 'f', 'F4', 'F4'
    Select 'Before', * from @Usr_Sessions
    OP_Query:
    BEGIN TRAN
    UPDATE A SET is_ended_at_trustable = 't' from @usr_Sessions A-- Select * from @Usr_Sessions "a" --
    WHERE (
    EXISTS (
    SELECT 1
    FROM @usr_sessions "b"
    WHERE "a"."ended_at" = "b"."started_at"
    AND "a"."usr_space_id" = "b"."usr_space_id"
    AND "a"."account_id" = "b"."account_id"
    ) ) AND "a"."is_ended_at_trustable" IS NULL
    Select 'After 1', * from @Usr_Sessions
    ROLLBACK TRAN /* Just to reset test data to original form, so second query below runs against original data */
    Dodge_Self_Join:
    With X as
    Select *
    , count(case when started_at = ended_at and is_ended_at_trustable is null then 'x' else null end)
    over(partition by account_id, usr_space_id) as Updatable
    From @Usr_Sessions
    Update X
    set is_ended_at_Trustable = 'T'
    where Updatable > 0 -- EDIT -- fixed error, previously said "updatable = 1"
    Select 'After 2', * from @Usr_Sessions

  • How to write self join in sql?

    Hi,
    I have table named "table_upload", column "record_type" value "01,03,04....." and start_date,end_date and so on
    And i will have value for  start_date,end_date only for record_type=01,rest of type these two columns will be null.
    now i need to write query with self join, to include above concept. can any one please help me .
    and my query look like follows,

    I just want to re write
    Please provide DDL+DML + expected output!
    and short explanation what is it that we all ask you for:
    DDL = Data Definition Language. In our case that is, CREATE TABLE statements for your tables and other definitions that are needed to understand your tables structure and there for let us to test and reproduce the problem in our server. Without DDL no one
    can execute any query.
    How to get DDL: Right click on the table in Object Explorer and select script table as CREATE. Post these create table scripts here.
    DML = data manipulation language is a family of queries used for manipulating the data it self like: inserting, deleting and updating data. In our case we need some sample data in order to check the query and get result, so we need some indert query for
    sample data.
    If you post a "create table query" for the tables and "insert <table> query" with some sample, then we could help you without Assuming/Guessing. There is a reason that DDL is generally asked for and expected when discussing query problems - it helps
    to identify issues, clarify terminology and prevent incorrect assumptions.  Sample data also provides a common point of reference for the discussion. A script that can be used to illustrate or reproduce the issue you have, will encourage others to help.
    [Personal Site] [Blog] [Facebook]

  • How is performance of Appache Web Server  + Tomcat?

    I am wondering how the performance of Appache web server + Tomcat => Java enabled web server is ?
    such as handling multiple users, heavy web traffic, JSP-JavaBean performance...in a real industrial setting?
    If "Appache web server + Tomcat" is an excellent choice, why companies still spend big bucks on things like WebLogic, JRun, etc?
    Thanks in advance for any light thrown on this topic.
    --Tim                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thanks for your reply. I think that I did not make myself clear. I meant that if a small company just wants to build a web application for internal/intranet use (which only utilizes JSP/JavaBean and Servlet features). No EJB, no JMS, etc. Will Appache web server + Tomcat suffice, say for scores of users to access this application concurrently?
    Thanks again.
    --Tim                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to Avoid Self Join

    Hi
    Assume I have following table
    Id Code
    1 aa
    1 bb
    1 cc
    2 bb
    2 cc
    The records will be grouped by Id. I want to find out group containing code say 'aa' and 'bb'.
    Is it possible to obtain the desired result in a single query without using Self join?
    Regards
    ~Pravin

    This is a little clumsy....Anyway try it:
    WITH t AS
    (SELECT 1 id,'aa' code FROM dual
    UNION ALL
    SELECT 1,'bb' FROM dual
    UNION ALL
    SELECT 1,'cc' FROM dual
    UNION ALL
    SELECT 2,'bb' FROM dual
    UNION ALL
    SELECT 2,'cc' FROM dual)
    SELECT id FROM t
    WHERE code IN('aa', 'bb')
    GROUP BY id HAVING COUNT(*) = 2;

  • Recursive Self Join

    Hi. I need to query the database of a document management system.   Documents are logically stored in folders in a tree structure and may be nested to arbitrary depth.  The FOLDER table lists the names and metadata of folders. 
    Ultimately, I want to join the FOLDER table ("f") to the DOCUMENT table ("d") to get a list of documents by folder.  The main thing I need help with is to build folder paths.  I don't necessarily even
    need to build full paths.  I would be happy just listing all the individual folders under the root, and the documents they contain.  I imagine to build folder paths involves a self join, but I don't know how to hadle arbitrary depth
    The first two columns of the FOLDER table are FOLDER_ID and PARENT_FOLDER_ID.  The data looks like this (where FOLDER_ID 1 represents the root folder):
    FOLDER_ID     PARENT_FOLDER_ID
    1                    null
    2                    1
    3                    1
    4                    1
    5                    2
    6                    2
    7                    1
    etc.
    Thanks for your help!

    See Itzik Ben-Gan examples dealing with such queries.
    CREATE TABLE Employees
      empid   int         NOT NULL,
      mgrid   int         NULL,
      empname varchar(25) NOT NULL,
      salary  money       NOT NULL,
      CONSTRAINT PK_Employees PRIMARY KEY(empid),
      CONSTRAINT FK_Employees_mgrid_empid
        FOREIGN KEY(mgrid)
        REFERENCES Employees(empid)
    CREATE INDEX idx_nci_mgrid ON Employees(mgrid)
    SET NOCOUNT ON
    INSERT INTO Employees VALUES(1 , NULL, 'Nancy'   , $10000.00)
    INSERT INTO Employees VALUES(2 , 1   , 'Andrew'  , $5000.00)
    INSERT INTO Employees VALUES(3 , 1   , 'Janet'   , $5000.00)
    INSERT INTO Employees VALUES(4 , 1   , 'Margaret', $5000.00) 
    INSERT INTO Employees VALUES(5 , 2   , 'Steven'  , $2500.00)
    INSERT INTO Employees VALUES(6 , 2   , 'Michael' , $2500.00)
    INSERT INTO Employees VALUES(7 , 3   , 'Robert'  , $2500.00)
    INSERT INTO Employees VALUES(8 , 3   , 'Laura'   , $2500.00)
    INSERT INTO Employees VALUES(9 , 3   , 'Ann'     , $2500.00)
    INSERT INTO Employees VALUES(10, 4   , 'Ina'     , $2500.00)
    INSERT INTO Employees VALUES(11, 7   , 'David'   , $2000.00)
    INSERT INTO Employees VALUES(12, 7   , 'Ron'     , $2000.00)
    INSERT INTO Employees VALUES(13, 7   , 'Dan'     , $2000.00)
    INSERT INTO Employees VALUES(14, 11  , 'James'   , $1500.00)
    The first request is probably the most common one:
     returning an employee (for example, Robert whose empid=7) 
    and his/her subordinates in all levels. 
    The following CTE provides a solution to this request:
    WITH EmpCTE(empid, empname, mgrid, lvl)
    AS
      -- Anchor Member (AM)
      SELECT empid, empname, mgrid, 0
      FROM Employees
      WHERE empid = 7
      UNION ALL
      -- Recursive Member (RM)
      SELECT E.empid, E.empname, E.mgrid, M.lvl+1
      FROM Employees AS E
        JOIN EmpCTE AS M
          ON E.mgrid = M.empid
    SELECT * FROM EmpCTE
    Using this level counter you can limit the number of iterations
     in the recursion. For example, the following CTE is used to return 
    all employees who are two levels below Janet:
    WITH EmpCTEJanet(empid, empname, mgrid, lvl)
    AS
      SELECT empid, empname, mgrid, 0
      FROM Employees
      WHERE empid = 3
      UNION ALL
      SELECT E.empid, E.empname, E.mgrid, M.lvl+1
      FROM Employees as E
        JOIN EmpCTEJanet as M
          ON E.mgrid = M.empid
      WHERE lvl < 2
    SELECT empid, empname
    FROM EmpCTEJanet
    WHERE lvl = 2
    As mentioned earlier, CTEs can refer to
     local variables that are defined within the same batch.
     For example, to make the query more generic, you can use 
    variables instead of constants for employee ID and level:
    DECLARE @empid AS INT, @lvl AS INT
    SET @empid = 3 -- Janet
    SET @lvl   = 2 -- two levels
    WITH EmpCTE(empid, empname, mgrid, lvl)
    AS
      SELECT empid, empname, mgrid, 0
      FROM Employees
      WHERE empid = @empid
      UNION ALL
      SELECT E.empid, E.empname, E.mgrid, M.lvl+1
      FROM Employees as E
        JOIN EmpCTE as M
          ON E.mgrid = M.empid
      WHERE lvl < @lvl
    SELECT empid, empname
    FROM EmpCTE
    WHERE lvl = @lvl
    Results generated thus far might be returned (but are not guaranteed to be), 
    and error 530 is generated. You might think of using the MAXRECURSION option 
    to implement the request to return employees who are two levels below 
    Janet using the MAXRECURSION hint instead of the filter in the recursive member
    WITH EmpCTE(empid, empname, mgrid, lvl)
    AS
      SELECT empid, empname, mgrid, 0
      FROM Employees
      WHERE empid = 1
      UNION ALL
      SELECT E.empid, E.empname, E.mgrid, M.lvl+1
      FROM Employees as E
        JOIN EmpCTE as M
          ON E.mgrid = M.empid
    SELECT * FROM EmpCTE
    OPTION (MAXRECURSION 2)
    WITH EmpCTE(empid, empname, mgrid, lvl, sortcol)
    AS
      SELECT empid, empname, mgrid, 0,
        CAST(empid AS VARBINARY(900))
      FROM Employees
      WHERE empid = 1
      UNION ALL
      SELECT E.empid, E.empname, E.mgrid, M.lvl+1,
        CAST(sortcol + CAST(E.empid AS BINARY(4)) AS VARBINARY(900))
      FROM Employees AS E
        JOIN EmpCTE AS M
          ON E.mgrid = M.empid
    SELECT
      REPLICATE(' | ', lvl)
        + '(' + (CAST(empid AS VARCHAR(10))) + ') '
        + empname AS empname
    FROM EmpCTE
    ORDER BY sortcol
    (1) Nancy
     | (2) Andrew
     |  | (5) Steven
     |  | (6) Michael
     | (3) Janet
     |  | (7) Robert
     |  |  | (11) David
     |  |  |  | (14) James
     |  |  | (12) Ron
     |  |  | (13) Dan
     |  | (8) Laura
     |  | (9) Ann
     | (4) Margaret
     |  | (10) Ina
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Set operator Vs Self join

    hi all,
    i have a main table and a corresponding history table.
    Like employee and h_employee both has primary key as emp_id.
    now i want a query which should only retrieve the common values among these two table.
    I have an idea of doing this in two way 1.self join 2. set operator
    1.select emp_id
    from emp e,h_emp h
    using (emp_id)
    2. select emp_id from emp
    intersect
    select emp_id from h_emp
    now guide me which gives better performance? how to evaluate the performance in PL/SQL Developer client?
    is there any keyword to trace the timing of the each query?
    Please advice.
    Regards,
    Slu

    Set operators combines the output of 2 or more queries into single output....
    Internally its doing sorting the two tables
    Join is just matching the records based on the where condition ....
    use Explain plan to the cost of the query
    SQL> Explain plan for select emp_id
    from emp e,h_emp h
    using (emp_id)
    and use
    SQL > select * from plan_table
    to see the cost...
    Edited by: LPS on Jul 12, 2011 12:08 AM

  • How to write a "Count" Formula in Webi 4.1

    Hi,
    I have a webi report (Datasource is Excel) where I have a self join (merged Dimension) on the 'YearMonth' . I am bringing all the 'filed Dates' from one query and all the 'Settled' dates from another query. (Same excel datasource for these queries, created a merged dimension). Now, I am trying to write a 'Count' formula (Please see below), to count all the '#GO" where 'Settled Date is Current Year. The issue is, when the 'Filed date' and 'Settled Date' is 'current year', but the filed month is different, then it is counting the 'Settled Month' in the 'Filed Month'. For ex: If the issue is settled in 'April'2014, but filed in 'March'2014, it is counting the settled Month as 'March'2014' instead of 'April'2014'. How do I get the count of all the issues settled in the current year, regardless of 'Filed Month' or 'Filed Year'. Please help.
    Thanks,
    Charvi.

    Hi,
    IS the empty rows comming from backend or do you have any variables in the columns that has null values?.
    If it is a varaible then Create : =if(Var1 = 0  or isnull(Var1)) then "Hide" else "Display"
    Create a report filter on "Var1" and select "Hide".
    Thanks,
    Jothi

  • How Can We Tune the Joins with "OR" Caluse ?

    Hi
    We've identified one Query in one of Our PL/SQL Stored Procedure which is taking huge time to fetch the records. I have simulated the problem as shown below. The problem Is, How can i tune the Jions with "OR" Clause. i have tried replacing them with Exists Caluse, But the Performance was not much was expected.
    CREATE TABLE TEST
    (ID NUMBER VDATE DATE );
    BEGIN
      FOR i IN 1 .. 100000 LOOP
        INSERT INTO TEST
        VALUES
          (i, TO_DATE(TRUNC(DBMS_RANDOM.VALUE(2452641, 2452641 + 364)), 'J'));
        IF MOD(i, 1000) = 0 THEN
          COMMIT;
        END IF;
      END LOOP;
    END;
    CREATE TABLE RTEST1 ( ID NUMBER, VMONTH NUMBER );
    INSERT INTO RTEST1
    SELECT ID, TO_NUMBER(TO_CHAR(VDATE,'MM'))
    FROM TEST ;
    CREATE TABLE RTEST2 ( ID NUMBER, VMONTH NUMBER );
    INSERT INTO RTEST2
    SELECT ID, TO_NUMBER(TO_CHAR(VDATE,'MM'))
    FROM TEST;
    CREATE INDEX RTEST1_IDX2 ON RTEST1(VMONTH)
    CREATE INDEX RTEST2_IDX1 ON RTEST2(VMONTH)
    ALTER TABLE RTEST1 ADD CONSTRAINT RTEST1_PK  PRIMARY KEY (ID)
    ALTER TABLE RTEST2 ADD CONSTRAINT RTEST2_PK  PRIMARY KEY (ID)
    SELECT A.ID, B.VMONTH
    FROM RTEST1 A , RTEST2 B
    WHERE A.ID = B.ID  
    AND ( (A.ID = B.VMONTH) OR ( B.ID = A.VMONTH ) )  
    BEGIN
    DBMS_STATS.gather_table_stats(ownname => 'PHASE30DEV',tabname => 'RTEST1');  
    DBMS_STATS.gather_table_stats(ownname => 'PHASE30DEV',tabname => 'RTEST2');
    DBMS_STATS.gather_index_stats(ownname => 'PHASE30DEV',indname => 'RTEST1_IDX1');
    DBMS_STATS.gather_index_stats(ownname => 'PHASE30DEV',indname => 'RTEST2_IDX2');
    DBMS_STATS.gather_index_stats(ownname => 'PHASE30DEV',indname => 'RTEST1_IDX2');
    DBMS_STATS.gather_index_stats(ownname => 'PHASE30DEV',indname => 'RTEST2_IDX1');
    END; Pls suggest !!!!!!! How can I tune the Joins with "OR" Clause.
    Regards
    RJ

    I don't like it, but you could use a hint:
    SQL>r
      1  SELECT A.ID, B.VMONTH
      2  FROM RTEST1 A , RTEST2 B
      3  WHERE A.ID = B.ID
      4* AND ( (A.ID = B.VMONTH) OR ( B.ID = A.VMONTH ) )
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=94 Card=2 Bytes=28)
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'RTEST2' (Cost=94 Card=1 Bytes=7)
       2    1     NESTED LOOPS (Cost=94 Card=2 Bytes=28)
       3    2       TABLE ACCESS (FULL) OF 'RTEST1' (Cost=20 Card=100000 Bytes=700000)
       4    2       BITMAP CONVERSION (TO ROWIDS)
       5    4         BITMAP AND
       6    5           BITMAP CONVERSION (FROM ROWIDS)
       7    6             INDEX (RANGE SCAN) OF 'RTEST2_PK' (UNIQUE)
       8    5           BITMAP OR
       9    8             BITMAP CONVERSION (FROM ROWIDS)
      10    9               INDEX (RANGE SCAN) OF 'RTEST2_IDX1' (NON-UNIQUE)
      11    8             BITMAP CONVERSION (FROM ROWIDS)
      12   11               INDEX (RANGE SCAN) OF 'RTEST2_PK' (UNIQUE)
    Statistics
              0  recursive calls
              0  db block gets
         300332  consistent gets
              0  physical reads
              0  redo size
            252  bytes sent via SQL*Net to client
            235  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              2  rows processed
    SQL>SELECT /*+ ordered use_hash(b) */ A.ID, B.VMONTH
      2    FROM RTEST1 A, RTEST2 B
      3   WHERE A.ID = B.ID  AND(A.ID = B.VMONTH OR B.ID = A.VMONTH)
      4  ;
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=175 Card=2 Bytes=28)
       1    0   HASH JOIN (Cost=175 Card=2 Bytes=28)
       2    1     TABLE ACCESS (FULL) OF 'RTEST1' (Cost=20 Card=100000 Bytes=700000)
       3    1     TABLE ACCESS (FULL) OF 'RTEST2' (Cost=20 Card=100000 Bytes=700000)
    Statistics
              9  recursive calls
              0  db block gets
            256  consistent gets
            156  physical reads
              0  redo size
            252  bytes sent via SQL*Net to client
            235  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              2  rows processed

  • When (or how) is a job available as a web service?

    We've created a web client application which is able to launch a job from web services. So I create a job with Data Services, but I can't tell how I'm supposed to make the job available to the client.
    If I call the job right directly after I create it, then I get a message that the job isn't known. But if I open the Management Console and open the Web Services Configuration tab, then I see my new job and I can call it. If I then create a new job in the Designer, I have to simply perform a refresh on the Web Services Configuration tab in order to be able to call the job.
    It seems that the simple act of opening the Web Services Configuration tab enables the job, but I kind of think this means that I'm not doing something right. Perhaps I'm missing a call in the client? Can anyone point me in the right direction (like specific section of a specific document)? All I can find is information on how to generate the WDSL, but I don't think I need that.
    I'd really like to eliminate any need to do manual steps between creating the job and calling it.
    BTW, we changed the generated code to be more generic so that we wouldn't have to generate it every time we wanted to add a job to web services. So instead of calling the hard-coded get<job-name>_GlobalVariables(), we completely re-wrote the serializer and build the global variables string dynamically.
    Thanks for your help.
    Edited by: Kim Wykoff on Sep 11, 2008 3:52 PM

    So you are saying that for any new job you create in the repository, it is added automatically in the Management Console as a webservice ? That's very weird and definitely not what I'm seeing in my environment...
    Could this be linked to changes you made ? I didn't fully understand what you mean with your quote below - did you make changes to the Data Services code in the Management Console (???) or just changed the generated WSDL ?
    >
    Kim Wykoff wrote:
    > BTW, we changed the generated code to be more generic so that we wouldn't have to generate it every time we wanted to add a job to web services. So instead of calling the hard-coded get<job-name>_GlobalVariables(), we completely re-wrote the serializer and build the global variables string dynamically.
    >
    Let's provide some background information on why we need the additional step of enabling a job in the Management Console and not expose any job in the repo as a web service.
    We require this additional step for security reasons. We want an administrator to enable only those jobs that can be consumed by external applications. This gives some level of control on which jobs can be executed (so not jobs currently in dev or jobs that load sensitive data, ...).
    We've made an enhancement however in the upcoming Data Services  XI 3.1 release (available one of the next weeks) to make this more flexible. And I think this is exactly what you were trying to accomplish with the WSDL modifications. A new generic webservice is provided that can launch any enabled job, together with an operation to get a list of all enabled jobs. So you no longer need to hardcode all the operations for each job in the client application. Additionally we've also added a webservice operation to retrieve the input schema for a real-time job.

Maybe you are looking for

  • Can I use product key from Windows 7 32bit to 64bit?

    Hi, i have a Toshiba L505-10V and the original cds(2) with Windows 7 prenium 32-bit. I have downloaded windows 7 prenium 64bit from here http://www.techverse.net/download-windows-7-iso-x86-x64-microsofts-official-servers/ I use the key from 32 bit bu

  • URLClassLoader issues

    Hi, I'm trying to create a dynamic "class finding" ClassLoader using URLClassLoader and, at run-time, adding various dependency jar files to the class loader and then creating an instance of a class with this ClassLoader. However, the issue I am runn

  • How do I play all my Movies from the iTunes'  Library?

    How do I play all the Movies from within my LIBRARY without having to click PLAY everytime on each individual movie? All my movies in the Library have the check marks on them already. When I play my "Music" LIBRARY, as soon as a song is over the next

  • How to identify combination of created and deleted Bank Details

    Hi Experts, I will develop a report similar to standard report RFKABL00. The requirement is to display the date, time, vendor number, vendor name, changed by, field name, company, purchasing org, new value and old value everytime a user make a change

  • Using normal class file in the servlet

    Hello Friends; Now my problem is ; I generated a java file ; import drasys.or.mp.*; import drasys.or.mp.lp.*; public class optimize     public static void main(String[] args)     try         int r=1;         int s=0; .This file works perfect. It call