PAS QUERY: parent-child in to different columns from single dimension

Hello,
We are looking for the syntax to execute a PAS (Pilot Application Server) query with the following characteristics:
1)     Products dimension is hierarchically arranged by Product Type (parent) and the Product itself (child). There are other ancestors but we wonu2019t necessarily use them.
2)     We want to obtain a report through PAS scripting which allows us to display product hierarchy names in two different columns, i.e.: Column1 (Product Type) Column2 (Product) , but since they are part of the same hierarchy (dimension), we are not able to present the results as shown in the example below:
Example:
Product_Type     Product        Metric
Core               ProductX        MetricN
Core              ProductY        MetricN
New              ProductW        MetricN
New              ProductZ        MetricN
Any clues on how to attain this?
Thanks in advance.

Hi,
You can make use of CrossJoin function in MDX, I give a sample MDX based on the AdventureWorks database:
select {[Measures].[Reseller Sales Amount]} on 0,
crossjoin({[Sales Territory].[Sales Territory Group].[Sales Territory Group].members},{[Sales Territory].[Sales Territory Country].[Sales Territory Country].members}) on 1
from [Adventure Works]
After execut the MDX you will get the result like this:
Reseller Sales Amount
Europe
France
$4,607,537.94
Europe
Germany
$1,983,988.04
Europe
United Kingdom
$4,279,008.83
NA
NA
(null)
North America
Canada
$14,377,925.60
North America
United States
$53,607,801.21
Pacific
Australia
$1,594,335.38
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Similar Messages

  • Sum two different columns from two different tables

    Can you select and sum two different columns, from two different tables in the same sql statement?
    i.e.
    table1
    Item----OnHand_Qty
    A--------10
    A--------15
    B--------10
    B--------10
    C--------20
    table2
    Item----Trx_Qty
    A--------2
    A--------4
    A--------6
    B--------1
    B--------1
    C--------4
    I'm looking for the following results from a query
    Item----Sum(Onhand_Qty)---Sum(Trx_Qty)
    A--------25

    Like this?
    SQL> create table table1 (item,onhand_qty)
      2  as
      3  select 'A', 10 from dual union all
      4  select 'A', 15 from dual union all
      5  select 'B', 10 from dual union all
      6  select 'B', 10 from dual union all
      7  select 'C', 20 from dual union all
      8  select 'D', 30 from dual
      9  /
    Tabel is aangemaakt.
    SQL> create table table2 (item, trx_qty)
      2  as
      3  select 'A', 2 from dual union all
      4  select 'A', 4 from dual union all
      5  select 'A', 6 from dual union all
      6  select 'B', 1 from dual union all
      7  select 'B', 1 from dual union all
      8  select 'C', 4 from dual union all
      9  select 'E', 3 from dual
    10  /
    Tabel is aangemaakt.
    SQL> select nvl(t1.item,t2.item) item
      2       , t1.sum_onhand_qty
      3       , t2.sum_trx_qty
      4    from ( select item, sum(onhand_qty) sum_onhand_qty
      5             from table1
      6            group by item
      7         ) t1
      8         full outer join
      9         ( select item, sum(trx_qty) sum_trx_qty
    10             from table2
    11            group by item
    12         ) t2
    13         on (t1.item = t2.item)
    14  /
    I SUM_ONHAND_QTY SUM_TRX_QTY
    A             25          12
    B             20           2
    C             20           4
    E                          3
    D             30
    5 rijen zijn geselecteerd.Regards,
    Rob.

  • Interactive report: Can I exclude a particular column from single row view?

    Hi -- I posted on this yesterday (Possible to exclude interactive report column from single row display?
    a bit anxious for suggestions, I guess!
    I've added a column with edit-link functionality to my interactive report query (that is, the link
    is not attached to the database data... it's an additional column and shows an icon). It's also
    in addition to the default single row view link. (We need both.)
    Unfortunately, the Edit link column shows up in the single row view. I've pared it down as much
    as I can: the label is empty, and the null value shows as "-". But an extra row with "-" is pretty
    ugly. Is there a way to always, completely exclude this column from the single row view?
    I know I could put the edit link on a data column, but:
    1) I want the link to always be to the left of the data (and the user can re-order columns)
    2) when the user doesn't have edit privileges, the link will need to be disabled or just not
    be displayed, and I think that would be a problem if the link were on the data. (true?)
    Thanks,
    Carol

    Please disregard this thread, and the one it refers back to. I see a flaw in the design of what I was attempting to do! Creating the link for Editing as a column means the user could inadvertently not display it, or move it, or... any number of problematic scenarios.
    Thanks,
    Carol

  • Querying parent child sets

    Hi
    I have a cube with a dimension that has a value based hierarchy (id, description,parent)
    Is it possible to query the cube to get parent child sets ?
    I want the result set to look like
    Member Value Parent
    Parent_1 Measure_Value NULL
    Child_1.1 Measure_Value Parent_1
    Child_1.2 Measure_Value Parent_1
    Parent_2 Measure_Value NULL
    Child_2.1 Measure_Value Parent_2
    Child_2.2 Measure_Value Parent_2
    Also I am using a java front end,so I would like to do some pagination
    So I would like say 1st 50 sets , 2nd 50 sets and so on

    Cube Materialized Views are only created if you enable them and they are also only compatible with level based hierarchies. So MVs are not appropriate in your case.
    If you are generating your own SQL then you could consider a hybrid approach by combining OLAP DML and SQL to get the explicit list of members. First execute the following OLAP DML.
    LIMIT my_dim TO 'Parent_1' 'Parent_2'
    LIMIT my_dim ADD DESCENDANTS USING my_dim_parentrel
    SORT my_dim HIERARCHY my_dim_parentrelNow get the dimension members via either OLAP DML (e.g. REPORT command) or running SQL after the limit above. This gives you the explicit list of members that you can feed into a subsequent query.
    SELECT dim_key, ...
    FROM my_dim_view, cube_view
    WHERE
      <join condition>
      AND dim_key IN (...list from report command...}
      Make sure you set status back via ALLSTAT after getting the list or it will change results later.

  • Referencing different columns from different groups

    Hi all,
    I created a formula column in a group , say g1. This formula column references in a bind reference fashion one column from g1 and another column from another group , say g2. And when I run the report then there is an error because of the external reference from group g2. So how can I reference both the two columns because I must calculate something from both of the two columns !
    Thank you very much indeed.

    Hi,
    Here i'm facing similar problem.
    I have a query Q1 which will get data in two columns p_plan, p_real. And I have another Q2 which will bring the data in two columns m_plan, m_real. Now i want to display the difference of (p_plan - m_plan) and (p_real - m_real).
    Since these fields for which the diff should be calculated are present in two different groups, std error "below Frequency error is thrown.
    Any advice pls

  • Passing data to different internal tables with different columns from a comma delimited file

    Hi,
    I have a program wherein we upload a comma delimited file and based on the region( we have drop down in the selection screen to pick the region).  Based on the region, the data from the file is passed to internal table. For region A, we have 10 columns and for region B we have 9 columns.
    There is a split statement (split at comma) used to break the data into different columns.
    I need to add hard error messages if the no. of columns in the uploaded file are incorrect. For example, if the uploaded file is of type region A, then the uploaded file should be split into 10 columns. If the file contains lesser or more columns thenan error message should be added. Similar is the case with region B.
    I do not want to remove the existing split statement(existing code). Is there a way I can exactly pass the data into the internal table accurately? I have gone through some posts where in they have made use of the method cl_alv_table_create=>create_dynamic_table by passing the field catalog. But I cannot use this as I have two different internal tables to be populated based on the region. Appreciate help on this.
    Thanks,
    Pavan

    Hi Abhishek,
    I have no issues with the rows. I have a file with format like a1,b1,c1,d1,e1, the file should be uploaded and split at comma. So far its fine. After this, if the file is related to region A say Asia, then it should have 5 fields( as an example). So, all the 5 values a1,b1..e1 will be passed to 5 fields of itab1.
    I also have region B( say Europe)  whose file will have only 4 fields. So, file is of the form a2,b2,c2,d2. Again data is split at comma and passed to itab2.
    If some one loads file related to Asia and the file has only 4 fields  then the data would be incorrect. Similar is the case when someone tries to load Europe file with 5 fields related data. To avoid this, I want to validate the data uploaded. For this, I want to count the no. of fields (seperated by comma). If no. of fields is 5 then the file is related to Asia or if no. of fields is 4 then it is Europe file.
    Well, the no. of commas is nothing but no. of fields - 1. If the file is of the form a1,b1..e1 then I can say like if no. of commas = 4 then it is File Asia.But I am not sure how to write a code for this.Please advise.
    Thanks,
    Pavan

  • Need different rows from single query based on condition

    Hi,
    I have a table with 100 rows that holds employees and their roles.
    I need to write a SQL(not a PL/SQL block) as below
    1. When employee with role 'VP' logs in, the query should return all the 100 rows.
    2. When employee with role 'MGR' logs in, the query should return only those rows whose MGR is the logged in employee.
    3. When employee with role 'SALE_EXEC' logs in, it should return single rows corresponding to this SALE_EXEC.
    My requirement here is to get these outputs from a single query.
    Can anyone please help me with this.
    Thanks,
    Vivek.

    use vpd
    New Policy Groups
    When adding the policy to a table, view, or synonym, you can use the DBMS_RLS.ADD_GROUPED_POLICY interface to specify the group to which the policy belongs. To specify which policies will be effective, you add a driving context using the DBMS_RLS.ADD_POLICY_CONTEXT interface. If the driving context returns an unknown policy group, then an error is returned.
    If the driving context is not defined, then all policies are executed. Likewise, if the driving context is NULL, then policies from all policy groups are enforced. In this way, an application accessing the data cannot bypass the security setup module (which sets up application context) to avoid any applicable policies.
    You can apply multiple driving contexts to the same table, view, or synonym, and each of them will be processed individually. In this way, you can configure multiple active sets of policies to be enforced.
    Consider, for example, a hosting company that hosts Benefits and Financial applications, which share some database objects. Both applications are striped for hosting using a SUBSCRIBER policy in the SYS_DEFAULT policy group. Data access is partitioned first by subscriber ID, then by whether the user is accessing the Benefits or Financial applications (determined by a driving context). Suppose that Company A, which uses the hosting services, wants to apply a custom policy which relates only to its own data access. You could add an additional driving context (such as COMPANY A SPECIAL) to ensure that the additional, special policy group is applied for data access for Company A only. You would not apply this under the SUBSCRIBER policy, because the policy relates only to Company A, and it is more efficient to segregate the basic hosting policy from other policies.
    How to Implement Policy Groups
    To create policy groups, the administrator must do two things:
    Set up a driving context to identify the effective policy group.
    Add policies to policy groups as required.
    The following example shows how to perform these tasks.
    Note:
    You need to set up the following data structures for the examples in this section to work:
    DROP USER finance CASCADE;
    CREATE USER finance IDENTIFIED BY welcome2;
    GRANT RESOURCE TO apps;
    DROP TABLE apps.benefit;
    CREATE TABLE apps.benefit (c NUMBER);
    Step 1: Set Up a Driving Context
    Begin by creating a namespace for the driving context. For example:
    CREATE CONTEXT appsctx USING apps.apps_security_init;
    Create the package that administers the driving context. For example:
    CREATE OR REPLACE PACKAGE apps.apps_security_init IS
    PROCEDURE setctx (policy_group VARCHAR2);
    END;
    CREATE OR REPLACE PACKAGE BODY apps.apps_security_init AS
    PROCEDURE setctx ( policy_group varchar2 ) IS
    BEGIN
    REM Do some checking to determine the current application.
    REM You can check the proxy if using the proxy authentication feature.
    REM Then set the context to indicate the current application.
    DBMS_SESSION.SET_CONTEXT('APPSCTX','ACTIVE_APPS', policy_group);
    END;
    END;
    Define the driving context for the table APPS.BENEFIT.
    BEGIN
    DBMS_RLS.ADD_POLICY_CONTEXT('apps','benefit','APPSCTX','ACTIVE_APPS');
    END;
    Step 2: Add a Policy to the Default Policy Group.
    Create a security function to return a predicate to divide the data by company.
    CREATE OR REPLACE FUNCTION by_company (sch varchar2, tab varchar2)
    RETURN VARCHAR2 AS
    BEGIN
    RETURN 'COMPANY = SYS_CONTEXT(''ID'',''MY_COMPANY'')';
    END;
    Because policies in SYS_DEFAULT are always executed (except for SYS, or users with the EXEMPT ACCESS POLICY system privilege), this security policy (named SECURITY_BY_COMPANY), will always be enforced regardless of the application running. This achieves the universal security requirement on the table: namely, that each company should see its own data regardless of the application that is running. The function APPS.APPS_SECURITY_INIT.BY_COMPANY returns the predicate to make sure that users can only see data related to their own company:
    BEGIN
    DBMS_RLS.ADD_GROUPED_POLICY('apps','benefit','SYS_DEFAULT',
    'security_by_company',
    'apps','by_company');
    END;
    Step 3: Add a Policy to the HR Policy Group
    First, create the HR group:
    CREATE OR REPLACE FUNCTION hr.security_policy
    RETURN VARCHAR2
    AS
    BEGIN
    RETURN 'SYS_CONTEXT(''ID'',''TITLE'') = ''MANAGER'' ';
    END;
    The following creates the policy group and adds a policy named HR_SECURITY to the HR policy group. The function HR.SECURITY_POLICY returns the predicate to enforce security on the APPS.BENEFIT table:
    BEGIN
    DBMS_RLS.CREATE_POLICY_GROUP('apps','benefit','HR');
    DBMS_RLS.ADD_GROUPED_POLICY('apps','benefit','HR',
    'hr_security','hr','security_policy');
    END;
    Step 4: Add a Policy to the FINANCE Policy Group
    Create the FINANCE policy:
    CREATE OR REPLACE FUNCTION finance.security_policy
    RETURN VARCHAR2
    AS
    BEGIN
    RETURN ('SYS_CONTEXT(''ID'',''DEPT'') = ''FINANCE'' ');
    END;
    Create a policy group named FINANCE and add the FINANCE policy to the FINANCE group:
    BEGIN
    DBMS_RLS.CREATE_POLICY_GROUP('apps','benefit','FINANCE');
    DBMS_RLS.ADD_GROUPED_POLICY('apps','benefit','FINANCE',
    'finance_security','finance', 'security_policy');
    END;
    As a result, when the database is accessed, the application initializes the driving context after authentication. For example, with the HR application:
    execute apps.security_init.setctx('HR');
    Validating the Application Used to Connect to the Database
    The package implementing the driving context must correctly validate the application that is being used to connect to the database. Although the database always checks the call stack to ensure that the package implementing the driving context sets context attributes, inadequate validation can still occur within the package.
    For example, in applications where database users or enterprise users are known to the database, the user needs the EXECUTE privilege on the package that sets the driving context. Consider a user who knows that:
    The BENEFITS application allows more liberal access than the HR application
    The setctx procedure (which sets the correct policy group within the driving context) does not perform any validation to determine which application is actually connecting. That is, the procedure does not check either the IP address of the incoming connection (for a three-tier system) or the proxy_user attribute of the user session.
    Such a user could pass to the driving context package an argument setting the context to the more liberal BENEFITS policy group, and then access the HR application instead. Because the setctx does no further validation of the application, this user bypasses the normally more restrictive HR security policy.
    By contrast, if you implement proxy authentication with VPD, then you can determine the identity of the middle tier (and the application) that is actually connecting to the database on behalf of a user. In this way, the correct policy will be applied for each application to mediate data access.
    For example, a developer using the proxy authentication feature could determine that the application (the middle tier) connecting to the database is HRAPPSERVER. The package that implements the driving context can thus verify whether the proxy_user in the user session is HRAPPSERVER. If so, then it can set the driving context to use the HR policy group. If proxy_user is not HRAPPSERVER, then it can disallow access.
    In this case, when the following query is executed
    SELECT * FROM APPS.BENEFIT;
    Oracle Database picks up policies from the default policy group (SYS_DEFAULT) and active namespace HR. The query is internally rewritten as follows:
    SELECT * FROM APPS.BENEFIT WHERE COMPANY = SYS_CONTEXT('ID','MY_COMPANY') and SYS_CONTEXT('ID','TITLE') = 'MANAGER';
    How to Add a Policy to a Table, View, or Synonym
    The DBMS_RLS package enables you to administer security policies by using its procedures for adding, enabling, refreshing, or dropping policies, policy groups, or application contexts. You need to specify the table, view, or synonym to which you are adding a policy, as well as the data pertinent to that policy, such as the policy name. Such data also includes names for the policy group and the function implementing the policy. You can also specify the types of statements the policy controls (SELECT, INSERT, UPDATE, DELETE, CREATE INDEX, or ALTER INDEX).
    for more you can refer to
    http://download-west.oracle.com/docs/cd/B19306_01/network.102/b14266/apdvcntx.htm

  • How can I Generate two different reports from single execution of Test cases in NI teststand

    Hi,
    My requirement is to generate two different reports from NI teststand. One for the Logging of error descriptions and the other report is by default generated by the Teststand. How can i generate a txt file that contains error descriptions other than that mentioned in the default report?
    Solved!
    Go to Solution.

    Do you need to do that just for these two sequences but not for other sequences? I don't see a problem to use SequenceFilePostStepRuntimeError. Create this callback in both sequence files and configure them to log into the same file. SequenceFilePostStepRuntimeError callback is called after each step of the sequence file if it has runtime error. You can access the calling step error information via RunState.Caller.Step.Result.Error property. Take a look to attached example.
    The "other way" is useful if you need to log errors not for every step of the sequence file, but for some of them. This is more complex, because you need to create a custom step types for these steps. For the custom step you can create substeps (post-step in your case) which will be executed every time after step of this type executed. Then, this is you job to determine if error happened in the step, acces to step's error information is via Step.Result.Error property. 
    Also, be aware that step's post-expression is not executed in case of error in the step.
    Sergey Kolbunov
    CLA, CTD
    Attachments:
    SequenceFilePostStepRuntimeError_Demo.seq ‏7 KB

  • Complex Query -Parent/Child

    Dear All,
    I have a strange requirement of generating report from a table, which has 2 columns trace element and trace reference where the relationship between trace reference and trace element is 1-Many. i.e each trace reference may have may childs and Each child may inturn may act as parent and it can have child records
    WITH t AS
    SELECT 'BSC/SR/0001/0002' AS trace_reference,'BSC/DS/0007/0013' AS trace_element from dual
    UNION ALL
    SELECT 'BSC/SR/0001/0002','BSC/DS/0004/0001' FROM dual
    UNION ALL
    SELECT 'BSC/SR/0001/0002','BSC/DS/0007/0033' FROM dual
    select * from tOutput
    trace Reference         trace_element
    BSC/SR/0001/0002     BSC/DS/0007/0013
    BSC/SR/0001/0002     BSC/DS/0004/0001
    BSC/SR/0001/0002     BSC/DS/0007/0033
    Each of the trace element will inturn have some child records like below
    WITH t1 AS
    SELECT 'BSC/DS/0007/0013' AS trace_reference,'BSC/US/0003/0008' AS trace_element FROM dual
    UNION ALL
    SELECT 'BSC/DS/0007/0013','BSC/STC/0008/0002' FROM dual
    SELECT * FROM t1Ouput
    trace Reference         trace_element
    BSC/DS/0007/0013     BSC/US/0003/0008
    BSC/DS/0007/0013     BSC/STC/0008/0002And the child record "BSC/US/0003/0008" May also have some child records.
    WITH t3 AS
    SELECT 'BSC/US/0003/0008' AS trace_reference,'BSC/UTC/0015/0003' AS trace_element FROM dual
    select * from t3
    Output trace Reference trace_element
    BSC/US/0003/0008     BSC/UTC/0015/0003
    Now the final output what i want is SR_TRC | BR_TRC | US_TRC | UTC_TRC
    BSC/SR/0001/0002     BSC/DS/0007/0013 BSC/US/0003/0008 BSC/UTC/0015/0003
    BSC/SR/0001/0002 BSC/DS/0007/0013 BSC/US/0003/0008 BSC/STC/0008/0002
    BSC/SR/0001/0002 BSC/DS/0007/0013 BSC/US/0003/0008 BSC/UTC/0015/0003
    So kindly suggest how to acheive the above result                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    Thanks for posting the sample data.
    Achyut K wrote:
    ... Now the final output what i want is
    SR_TRC | BR_TRC | US_TRC | UTC_TRC
    BSC/SR/0001/0002     BSC/DS/0007/0013 BSC/US/0003/0008 BSC/UTC/0015/0003
    BSC/SR/0001/0002 BSC/DS/0007/0013 BSC/US/0003/0008 BSC/STC/0008/0002
    BSC/SR/0001/0002 BSC/DS/0007/0013 BSC/US/0003/0008 BSC/UTC/0015/0003 It would help if you formatted the output. It's hard to tell if you want 1 column of output or 4 columns.
    If rows in t have children, those children will be in t1, but if rows in t1 have children, those children may either be in t1 or in t3; is that right?
    If so, do a CONNECT BY query on the UNION of t1 and t3, to get most of the columns; then join to t to get column st_trc, like this:
    WITH     combined_data     AS
         SELECT     trace_reference
         ,     trace_element
         FROM     t1
        UNION ALL
         SELECT     trace_reference
         ,     trace_element
         FROM     t3
    ,     connect_by_results     AS
         SELECT     CONNECT_BY_ROOT      trace_reference     AS br_trc
         ,     CONNECT_BY_ROOT  trace_element          AS us_trc
         ,     trace_element                    AS utc_trc
         FROM     combined_data
         WHERE     CONNECT_BY_ISLEAF     = 1
         CONNECT BY     trace_reference     = PRIOR  trace_element
    SELECT     t.trace_element          AS sr_trc
    ,     cbr.*
    FROM     t
    JOIN     connect_by_results  cbr      ON  cbr.br_trc     = t.trace_element
    ;If children of t can be in any table, then, instead of joining to t at the end, add t to the UNION in combined_results. In that case, you can add a START WITH clause, and you may need SYS_CONNECT_BY_PATH, depending on your exact requirements.

  • Calculating value based on parent/child relations for a column..

    Hi Friends,
    I have a requirement thus,
    sample table, parts,
    ppart cpart qty
    990 1234 200
    100 100_1 150
    100 100_2 2
    100_1 120 100
    100_1 121 200
    100_2 130 50
    where qty is a number and the rest are varchar fields. Here the ppart 100 is a parent value for cpart values 100_1 and 100_2. So, I need to multiply the qty value for a child with the parent's qty values. The final result would look like,
    ppart cpart qty
    990 1234 200
    100 100_1 150
    100 100_2 2
    100_1 120 15000
    100_1 121 30000
    100_2 130 100
    I have only a basic understanding of SQL but I couldnt figure out a way for this. My best try was to join the table with itself and equate the ppart and cpart columns to retrieve the qty. However, the actual table has about 50 million records and I guess my idea is not going to please my DBA! I would appreciate if you could suggest better ideas.
    Thanks.

    Hi,
    you forgot nvl()
    SQL> with parts as (select '990' ppart, '1234' cpart, 200 qty from dual union all
      2                select '100'  , '100_1', 150 from dual union all
      3                select '100'  , '100_2', 2   from dual union all
      4                select '100_1', '120'  , 100 from dual union all
      5                select '100_1', '121'  , 200 from dual union all
      6                select '100_2', '130'  , 50  from dual)
      7  select p.ppart parent_part, c.ppart child_part, p.qty parent_qty, p.qty * c.qty child_quantity
      8  from   parts c
      9  left join parts p on c.ppart = p.cpart
    10  /
    PAREN CHILD PARENT_QTY CHILD_QUANTITY                                          
    100   100_1        150          30000                                          
    100   100_1        150          15000                                          
    100   100_2          2            100                                          
          990                                                                      
          100                                                                      
          100                                                                      
    6 rows selected.
    SQL> with parts as (select '990' ppart, '1234' cpart, 200 qty from dual union all
      2                select '100'  , '100_1', 150 from dual union all
      3                select '100'  , '100_2', 2   from dual union all
      4                select '100_1', '120'  , 100 from dual union all
      5                select '100_1', '121'  , 200 from dual union all
      6                select '100_2', '130'  , 50  from dual)
      7  select p.ppart,p.cpart, p.qty * nvl(c.qty,1) qty
      8  from   parts p,parts c
      9  where p.ppart = c.cpart(+)
    10  /
    PPART CPART        QTY                                                         
    100_1 121        30000                                                         
    100_1 120        15000                                                         
    100_2 130          100                                                         
    990   1234         200                                                         
    100   100_2          2                                                         
    100   100_1        150                                                         
    6 rows selected.

  • Possible to exclude interactive report column from single row display?

    hi -- I have an interactive report that I've added a column to (in addition to the table columns that are selected).
    The added column is a link to a form for editing a single row. This column/link is in addition to the default link
    that goes to a single row view. So, a row of the report has 1) the single row view link, 2) the Edit link,
    3) the columns in the table.
    The edit link column is named "Edit" (so Edit appears above the "pencil" link icon). Problem is that when the
    user goes to the single row view, the Edit column is displayed. (I've set the label in the view to a blank space,
    and the value is null (displayed as "-" in the single row view)... but it's generally ugly, and adds that nonsensical
    line to the single row view.
    Is there any way to never display that column in the single row view, but always display it in the report?
    I've considered putting the edit link on the first column of the table... but I don't like that the link will move
    if the user changes the column order. It seems it should always be at the left of the row, like the single row view
    link.
    Thanks,
    Carol

    Please disregard this thread. I see a flaw in the design of what I was attempting to do! Creating the link for Editing as a column means the user could inadvertently not display it, or move it, or... any number of problematic scenarios.
    Thanks,
    Carol

  • Defining 100 columns from single column

    hi all,
    i need to write an sp which returns many columns
    i have code ,name,candidates,mark(0-100)
    these are my columns in a table..
    now i need to calculate columns 0-100 which mark having how many students..like
    code name     [ MARKS- 1]                        [MARK- 2]       [
    3]        [ 4]      [5 ]  -----------[100]
    01   eng          10CANDIDATES                    2                
    10          64         44--------------98
    02   BEG          12CANDIDATES                   0                 
    12          77         98                  21
    FOR THIS I WROTE CODE LIKE
    SELECT Name,Code,Mark,CANDIDATES
    INTO #tmp
    FROM TABLENAME
    WHERE (CONDITION)
    SELECT
    Name,Code
    ,[1] = SUM(CASE WHEN Mark=1 THEN Nos ELSE 0 END)
    ,[2] = SUM(CASE WHEN Mark=2 THEN Nos ELSE 0 END)
    ,[3] = SUM(CASE WHEN Mark=3 THEN Nos ELSE 0 END)
    ,[4] = SUM(CASE WHEN Mark=4 THEN Nos ELSE 0 END)
    ,[5]= SUM(CASE WHEN Mark=5 THEN Nos ELSE 0 END)
    ,[6] = SUM(CASE WHEN Mark=6THEN Nos ELSE 0 END)
    ,[7] = SUM(CASE WHEN Mark=7 THEN Nos ELSE 0 END)
    ,[8]= SUM(CASE WHEN Mark=8 THEN Nos ELSE 0 END)
    ,[9]= SUM(CASE WHEN Mark=9 THEN Nos ELSE 0 END)
    ,[10]= SUM(CASE WHEN Mark=10 THEN Nos ELSE 0 END)
    ---SO ON UPTO 100---------------------------------------------
    FROM #tmp
    GROUP BY Name,Code
    NOW ITS too big code to define upto 100, so how caan i define in easiest way like any loop way? and simple code..pls help
    thanks in advance..
    lucky

    hi all,
    i need to write an sp which returns many columns
    i have code ,name,candidates,mark(0-100)
    these are my columns in a table..
    now i need to calculate columns 0-100 which mark having how many students..like
    code name     [ MARKS- 1]                        [MARK- 2]       [
    3]        [ 4]      [5 ]  -----------[100]
    01   eng          10CANDIDATES                    2                
    10          64         44--------------98
    02   BEG          12CANDIDATES                   0                 
    12          77         98                  21
    FOR THIS I WROTE CODE LIKE
    SELECT Name,Code,Mark,CANDIDATES
    INTO #tmp
    FROM TABLENAME
    WHERE (CONDITION)
    SELECT
    Name,Code
    ,[1] = SUM(CASE WHEN Mark=1 THEN Nos ELSE 0 END)
    ,[2] = SUM(CASE WHEN Mark=2 THEN Nos ELSE 0 END)
    ,[3] = SUM(CASE WHEN Mark=3 THEN Nos ELSE 0 END)
    ,[4] = SUM(CASE WHEN Mark=4 THEN Nos ELSE 0 END)
    ,[5]= SUM(CASE WHEN Mark=5 THEN Nos ELSE 0 END)
    ,[6] = SUM(CASE WHEN Mark=6THEN Nos ELSE 0 END)
    ,[7] = SUM(CASE WHEN Mark=7 THEN Nos ELSE 0 END)
    ,[8]= SUM(CASE WHEN Mark=8 THEN Nos ELSE 0 END)
    ,[9]= SUM(CASE WHEN Mark=9 THEN Nos ELSE 0 END)
    ,[10]= SUM(CASE WHEN Mark=10 THEN Nos ELSE 0 END)
    ---SO ON UPTO 100---------------------------------------------
    FROM #tmp
    GROUP BY Name,Code
    NOW ITS too big code to define upto 100, so how caan i define in easiest way like any loop way? and simple code..pls help
    thanks in advance..
    lucky
    Please post the create table script and sample data.
    - please mark correct answers

  • Parent Child Hierarchy causes numbers to be different

    Hello,
    We have a parent child hierarchy in our chart of account dimensions. When the hierarchy is included in an analysis, the numbers are correct. If the hierarchy is not included in the analysis and a column from the dimension with the hierarchy is included, the numbers are very different. They are overstated by a large amount.
    For Example, I have two analysis:
    -In the first analysis the hierarchy is included and the grand total is 2,383,080,784.
    -The second analysis has simply excluded the hierarchy from the analysis and the total shoots all the way up to 6,901,729,527.
    I have screen shots but don't know how to include them in this kind of a post.
    Has anybody else seen such behavior? This seems like it would be a big deal so either we are doing something wrong or this is a bug that needs fixed.
    We are on 11.1.1.6
    Thanks in advance,
    Brian

    Hi,
    Thanks for the reply, I'm actually using snapshots. But even with the Type 2 Dim I don't think it will work.
    When OBIEE generates the very first sql against the Parent-Child table the fact table is not included in the query. It seems to create 2 queries - one to find the top level parent (ancestor key is null) and then one to find all the leaf nodes.
    It does not have any join to the fact table when it does this. So if you have multiple rows in the table (with date stamps) for a single row (person in this case) - it picks up both rows. Therefore, when you have a person who was, say, promoted to manager, and WAS a leaf node, and is now a manager, they show up in the leaf query and don't display in the hierarchy as a manager.
    Once it has the leaf nodes and it joins to the fact table everything works (ie the surrogate key join).
    I'm trying to figure out if there is any way to influence those initial queries against the parent-child table.
    Hopefully that made sense.
    Thanks,
    Tori

  • Getting parent-child data from a single column in a table

    Hi,
    I have a parent-child data in a column.
    Eg:
    0
    00
    01
    010
    011
    1
    10
    11
    These values are present in the single column itself. My need is to get the parent values for the given child value.
    For eg: If I am giving the input as 011, the query should return all its parents, i.e. 01 and 0
    Could you please give me any inputs on this?
    Thanks,
    GV

    Frank Kulash wrote:
    Assuming that each child's id is formed by adding exactly one character to the end of its parent's id:
    SELECT     id
    FROM     table_x
    START WITH     id          = :target_id
    CONNECT BY     PRIOR id     LIKE id || '_';
    Small tweak to yours Frank if it's just the parents that need identifying...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select '0' as x from dual union all
      2             select '00' from dual union all
      3             select '01' from dual union all
      4             select '010' from dual union all
      5             select '011' from dual union all
      6             select '1' from dual union all
      7             select '10' from dual union all
      8             select '11' from dual)
      9  -- end of test data
    10  SELECT     x
    11  FROM       t, (select '&required' as req from dual) req
    12  WHERE x != req.req
    13  START WITH x = req.req
    14* CONNECT BY PRIOR x LIKE x || '_'
    SQL> /
    Enter value for required: 011
    old  11: FROM   t, (select '&required' as req from dual) req
    new  11: FROM   t, (select '011' as req from dual) req
    X
    01
    0
    SQL> /
    Enter value for required: 11
    old  11: FROM   t, (select '&required' as req from dual) req
    new  11: FROM   t, (select '11' as req from dual) req
    X
    1
    SQL>

  • Parent Child hierarchy Scenario

    Hi friends,
    Im just working on the parent child hierarchy using the following link with the sample data.
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bi11115/biadmin11g_02/biadmin11g.htm_
    I tried to implement the same hierarchy using my local data instead of referring to the sample data.
    I have a below query which returns the employee with manager along with the employee position
    select distinct papf.person_id,  papf.full_name "Employee Name", supf.person_id "Manager Id", supf.full_name "Manager Name", pj.name "Position Name"
    from per_all_people_f papf, per_all_assignments_f paaf, per_all_people_f supf, per_jobs pj
    where papf.person_id = paaf.person_id and supf.person_id = paaf.supervisor_id and paaf.job_id = pj.job_id
    and trunc(sysdate) between paaf.effective_start_date and paaf.effective_end_date and
    trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
    Im looking forward to implement the same result in my BI with a parent-child hierarchy.
    Since i have imported three tables to my physical layer
    per_all_people_f------------Dimension
    per_all_assignments_f-----Fact
    per_jobs---------------------DimensionFor creating parent-child in BI, we need to have a separate Parent child table which consist of four columns like ancestorkey, memberkey, distance, leaf.
    From the above column i can understand the meaning like
    For Ancestorkey-->Managerid
    Memberkey------->Employeeid
    But i couldnt get with the meaning for distance column as the meaning suggest like a distance b/w the two and leaf column as the meaning suggest like a leaf member. which leaf member does it refer.
    I also referred the below link then too couldnt get the meaning for it
    http://www.rittmanmead.com/2010/08/oracle-bi-ee-11g-parent-child-hierarchies-differing-aggregations/+
    How i can form the parent child table for the BI from my above three tables of HRMS.
    Thanks
    Regards,
    Saro

    Hi friends,
    I think i found a link of doing it
    http://prasadmadhasi.com/2011/11/15/hierarchies-parent-child-hierarchy-in-obiee-11g/
    Let me try this and will update accordingly.
    Thanks for your views.
    Regards,
    Saro

Maybe you are looking for

  • Print Report with multiple copies

    i have an one page report called Receipt voucher which is in format of form. I have an query. I have to take four prints of same report. but the problem is that if i take print of 1st copy it should appear on report like origional-Customer,2nd time-

  • Im having a bit of trouble downloading itunes for windows 8 and i dont know why! Please help!!

    Im Having trouble DL iTunes for Windows 8 using internet explorer. It DLs but then I get nothing. I go into my DL folder and its there, i click on it, shows its trying to do something and again nothing pops up. Am I doing something wrong???

  • Direct Connection to apple TV via wireless?

    Hi All, I have an 160gb Apple TV or order. I currently don't have my own network. Would it be possible to create a wireless network on my MacBook Pro and then use the Apple TV to connect to that network? Will iTunes then recognize it and sync? Would

  • Adobe Reader 9, Form Fields, Digital Signature

    I have already posted this in Adobe Reader forum and had no replies... probably the wrong area... We are a software company and we are developing a simple application, as follows: Any number of pdf documents are provided by a third party (our custome

  • Match is off but all songs show in Music app

    I have turned off Match but all songs still show up in Music app. This makes the music app very slow because Match has lots of songs from the iMac. I have a iPhone 4S. I restored iOS and I still have the problem. I also have an iPhone 5 logged in to