Tree query issue

Good morning,
Obviously, I simply do not understand the query that gets constructed to create a Tree structure in APEX. I have a Tree in Oracle Forms that works correctly. I cannot, however, seem to get it to port over to APEX.
In my table (a table of contents type of structure), I have 3 columns that govern where in the list an item falls. TOC_LEVEL (1 a parent-level entry, or 2 child-level entry), TOC_PARENT, what parent a child entry is associated with, and TOC_SEQ_ID, where in the list an item should be placed.
So, I might have entries like this:
TOC_LEVEL TOC_PARENT TOC_SEQ_ID
1 NULL 1
2 1 50
2 1 60
1 2 2
1 3 3
2 3 50 - dups here don't matter because it would fall under a different parent...
2 3 75
and so-on.
The query that I use in my Form is this:
select decode(level,-1,-1,-1),
level,
toc_description,
toc_entry_type,
toc_id
from toc where state_id = '&State_ID'
start with toc_level = 1
connect by prior toc_seq_id = TOC_Parent
and prior State_ID = '&State_ID'
order by to_char(toc_parent) || to_char(toc_seq_id)
and this works. I am able to display and retrieve the appropriate data.
I can NOT seem to get this or any variation to work within APEX.
The closest I have come is that I retrieve all of the parent-level entries, but retrieve the very same child-entries under each parent. And when I click the '+' on one parent, ALL parents expand... and the '-' colapses all parents, not just the one I clicked.
What is it that I am missing here?
Thanks,
Don

Hi Don,
The value for the hidden Pn_TREE_ROOT should be the id of the topmost item in your tree. If you have more than one that could be topmost, then you have to create a dummy root - this was described in the linked thread - and the ID of the dummy root should be used.
So, in your example, if more than one toc_parent entry can contain null, you have more than one root so must create a dummy root. If only one toc_parent entry contains null, then the ID of this record must be specified as the root.
The only thing you may have to do from the linked example, would be to convert the nulls for your actual pid values into 1 to get them to link to the new dummy parent.
So:
select 1 id, null pid, 'Rootname' name, null link, null a1, null a2 from link
union all
select
toc_level+1000000 id,
case when toc_parent is null then 1 else toc_parent+1000000 end pid,
toc_description name,
null link,
null a1,
null a2
from toc where state_id = 'ZZ';This creates a dummy root with an id of 1 and attaches all of your actual parents to this root. The actual ID values have to be increased to ensure that none of them could be a 1 and become attached to the root.
Andy

Similar Messages

  • Dataset query issues twice if the dataset is connected to matrix and used in multilookup function

    hello everybody.
    could not find any information if this is an intended behavior:
    dataset query issues twice if the dataset is connected to matrix and used in multilookup function
    parameters in both queries are the same
    ssrs: 2008 r2, sharepoint 2010 integrated
    sharepoint 2010: september 2014 cu
    thanks in advance
    Sergey Vdovin

    Hello, Wendy.
    I prepared a very empty sample report for you to demonstrate the problem - with this report, i hope, there is no place to discuss the shrinking of time data retrieval.
    There is one dataset, one parameter and one lookup function. The query is executed twice.
    <?xml version="1.0" encoding="utf-8"?>
    <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">
    <AutoRefresh>0</AutoRefresh>
    <DataSources>
    <DataSource Name="DataSource1">
    <DataSourceReference>http://t005/ProjectBICenter/DocLib/IntegrationDBVdovin.rsds</DataSourceReference>
    <rd:SecurityType>None</rd:SecurityType>
    <rd:DataSourceID>7e554344-d6c2-48a5-a7f4-1d24608cb4b5</rd:DataSourceID>
    </DataSource>
    </DataSources>
    <DataSets>
    <DataSet Name="DataSet1">
    <Query>
    <DataSourceName>DataSource1</DataSourceName>
    <CommandText>select 1 as temp, '$' as tempname</CommandText>
    <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
    </Query>
    <Fields>
    <Field Name="temp">
    <DataField>temp</DataField>
    <rd:TypeName>System.Int32</rd:TypeName>
    </Field>
    <Field Name="tempname">
    <DataField>tempname</DataField>
    <rd:TypeName>System.String</rd:TypeName>
    </Field>
    </Fields>
    </DataSet>
    </DataSets>
    <ReportSections>
    <ReportSection>
    <Body>
    <ReportItems>
    <Textbox Name="ReportTitle">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=Lookup(1,Fields!temp.Value,Fields!tempname.Value,"DataSet1")</Value>
    <Style>
    <FontFamily>Verdana</FontFamily>
    <FontSize>20pt</FontSize>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:WatermarkTextbox>Title</rd:WatermarkTextbox>
    <rd:DefaultName>ReportTitle</rd:DefaultName>
    <Top>0mm</Top>
    <Height>10.16mm</Height>
    <Width>139.7mm</Width>
    <Style>
    <Border>
    <Style>None</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </ReportItems>
    <Height>57.15mm</Height>
    <Style>
    <Border>
    <Style>None</Style>
    </Border>
    </Style>
    </Body>
    <Width>152.4mm</Width>
    <Page>
    <PageFooter>
    <Height>11.43mm</Height>
    <PrintOnFirstPage>true</PrintOnFirstPage>
    <PrintOnLastPage>true</PrintOnLastPage>
    <Style>
    <Border>
    <Style>None</Style>
    </Border>
    </Style>
    </PageFooter>
    <PageHeight>29.7cm</PageHeight>
    <PageWidth>21cm</PageWidth>
    <LeftMargin>2cm</LeftMargin>
    <RightMargin>2cm</RightMargin>
    <TopMargin>2cm</TopMargin>
    <BottomMargin>2cm</BottomMargin>
    <ColumnSpacing>0.13cm</ColumnSpacing>
    <Style />
    </Page>
    </ReportSection>
    </ReportSections>
    <ReportParameters>
    <ReportParameter Name="ReportParameter1">
    <DataType>String</DataType>
    <DefaultValue>
    <Values>
    <Value>1</Value>
    </Values>
    </DefaultValue>
    <Prompt>ReportParameter1</Prompt>
    <ValidValues>
    <DataSetReference>
    <DataSetName>DataSet1</DataSetName>
    <ValueField>temp</ValueField>
    <LabelField>tempname</LabelField>
    </DataSetReference>
    </ValidValues>
    </ReportParameter>
    </ReportParameters>
    <rd:ReportUnitType>Mm</rd:ReportUnitType>
    <rd:ReportServerUrl>http://t005/ProjectBICenter</rd:ReportServerUrl>
    <rd:ReportID>cd1262ef-eca7-4739-a2ce-d3ca832d5cd6</rd:ReportID>
    </Report>
    Sergey Vdovin

  • Calling boolean function from tree query

    Hi all,
    I have placed a tree on my sidebar region from the following query
    select PAGE_NO id,
    PARENT_PAGE_NO pid,
    NAME name,
    'f?p=&APP_ID.:'||page_no||':&SESSION.' link,
    null a1,
    null a2
    from #OWNER#.APEX_PAGES
    WHERE page_no = :APP_PAGE_ID
    AND nvl(navigation,'N') = 'Y'
    Its running perfectly fine. Now i have my custom function "isUserAllowed(app_user, name_of_node, isParent)" which returns a boolean expression is the logged in User has access privilege on that node.
    How can i run my function inside the tree query so that node is visible only for those values in which my function returns "true"? and not on others?
    With Regards,
    Sunil Bhatia

    The "wrapper" function would actually be pretty easy - just another function to call the one returning the boolean and convert it to some other value, numeric or character. something like (untested)
    <pre>
    FUNCTION wrapper_function(P_whatever varchar2) return varchar2 IS
    v_return_value_c varchar2(5);
    BEGIN
    r_return_value_c := case boolean_function(p_whatever)
    when true then 'true'
    else 'false;
    return v_return_value_c;
    END;
    </pre>
    Using the function in the WHERE clause could look something like this (untested, but should work if done correctly)
    <pre>
    select whatever
    from your_table
    where wrapper_function(whatever) = 'true'
    </pre>

  • Web Query issues

    Hi All,
    I have created a web query and assigned it to a role. I have moved the role, web templete and the query from dev to QA was able run the query fine without issues.
    The problem I am having is when I make changes to the query and transport it to QA...when I run the query from the role menu it still shows the old query instead of the changed query.
    Can someone please explain what are the steps I need to take when I make changes to exsisting web query in dev and move to QA and be able to see the changes. What are all the objects I need to collect. Also would like to know if there are any settings on the role menu or web templete that need to be changed and also any buffers that I need to cleared??
    Any help is appriciated and will give max points.
    Thanks

    BWdesi,
    please avoid reposts - it could be that due to network issues the post got posted twice... close one of them as answered and then proceed with the other one...
    Web Query issues
    Arun

  • Tree Query Problem

    I've problem with tree query where if a level > 3 the result for top level is incorrect. 
    Here's the query with correct result where level of depth just 3 level :
    --select *from tblBOMStructed
    DECLARE @BOMStructure TABLE
    PartNumber varchar(14)not null ,
    Descript varchar(50)not null,
    Qty integer not null default 0,
    Price Decimal (10,2) default 0,
    TotalPrice Decimal (10,2) default 0,
    ItemNumber varchar(14) not null primary key
    INSERT @BOMStructure
    (PartNumber ,Descript ,Qty ,Price ,ItemNumber)
    VALUES ('00150060060005','BASIC TANK',1,0,'1'),
    ('11012142200503','SHELL',1,789.89,'1.1'),
    ('12052140503','TOP CONE',1,226.75,'1.2'),
    ('13052140503','BOTTOM CONE',1,226.75,'1.3'),
    ('140104116508','PIPE LEG',3,39.75,'1.4'),
    ('15004104','BALL FEET',3,0,'1.5'),
    ('1510413504','SLEEVE',1,18.03,'1.5.1'),
    ('1524809510','ADJUSTABLE BOLT',1,12.82,'1.5.2'),
    ('1530411604','BASE',1,7.27,'1.5.3')
    -- Mengupdate
    update @BOMStructure
    set TotalPrice = 0
    where PartNumber in
    select PartNumber
    from @BOMStructure
    -- Mengisi Table Total Price
    update @BOMStructure
    set TotalPrice = Price * Qty;
    -- Mengupdate Sub Assy Dan Main Assy di kalikan dengan qty
    WITH cteParents(ItemNumber)
    AS (
    SELECT ItemNumber
    FROM @BOMStructure
    WHERE partnumber in (
    select e1.PartNumber from @BOMStructure e1,@BOMStructure e2
    where e2.ItemNumber > e1 .ItemNumber
    and e2.ItemNumber < e1 .ItemNumber + 'Z'
    and e1 .ItemNumber not like '1'
    and e2 .ItemNumber Not like '1'
    group by e1.PartNumber
    ), cteSource(ItemNumber, TotalPrice)
    AS (
    SELECT p.ItemNumber,
    SUM(COALESCE(s.TotalPrice , 0)) AS TotalPrice
    FROM cteParents AS p
    LEFT JOIN (
    SELECT ItemNumber AS Original,
    CASE
    WHEN ItemNumber LIKE '%.%' THEN ItemNumber
    ELSE '1.' + ItemNumber
    END AS ItemNumber,
    TotalPrice = Price * Qty
    FROM @BOMStructure
    ) AS s ON s.ItemNumber LIKE p.ItemNumber + '.%'
    OR p.ItemNumber = '1'--'0'
    WHERE s.Original NOT IN (SELECT ItemNumber FROM cteParents)
    GROUP BY p.ItemNumber
    UPDATE s
    SET s.TotalPrice = q.TotalPrice * s.Qty
    FROM @BOMStructure AS s
    INNER JOIN cteSource AS q ON q.ItemNumber = s.ItemNumber;
    --Mengupdate Harga Main Assy menggunakan function With
    with cteLevel(Lvl, PartNumber, TotalPrice)
    AS
    select LEN (ItemNumber)- LEN(REPLACE(ItemNumber, '.', ''))as Lvl, PartNumber,TotalPrice from @BOMStructure
    update s
    set s.TotalPrice = (select sum(TotalPrice )from cteLevel as PriceLvl1 where Lvl = 1)
    from @BOMStructure as s
    INNER JOIN cteLevel AS q ON q.PartNumber = s.PartNumber
    where s.ItemNumber = '1'
    update @BOMStructure
    set Price = TotalPrice / Qty
    --Kondisi Part Number yang merupakan Sub Assembly
    where PartNumber in (select e1.PartNumber from @BOMStructure e1,@BOMStructure e2
    where e2.ItemNumber > e1 .ItemNumber
    and e2.ItemNumber < e1 .ItemNumber + 'Z'
    and e1 .ItemNumber not like '1'
    and e2 .ItemNumber Not like '1'
    group by e1.PartNumber )
    update @BOMStructure
    set Price = TotalPrice / Qty
    where ItemNumber = '1'
    select PartNumber, Descript , Qty , Price , TotalPrice , ItemNumber
    from @BOMStructure
    Here's the query with incorrect result where level of depth > 3 level :
    --select *from tblBOMStructed
    DECLARE @BOMStructure TABLE
    PartNumber varchar(14)not null ,
    Descript varchar(50)not null,
    Qty integer not null default 0,
    Price Decimal (10,2) default 0,
    TotalPrice Decimal (10,2) default 0,
    ItemNumber varchar(14) not null primary key
    INSERT @BOMStructure
    (PartNumber ,Descript ,Qty ,Price ,ItemNumber)
    VALUES ('14300100001029','ATMOSPHERIC TANK',1,0,'1'),
    ('00150060060005','BASIC TANK',1,0,'1.1'),
    ('11012142200503','SHELL',1,789.89,'1.1.1'),
    ('12052140503','TOP CONE',1,226.75,'1.1.2'),
    ('13052140503','BOTTOM CONE',1,226.75,'1.1.3'),
    ('140104116508','PIPE LEG',3,39.75,'1.1.4'),
    ('15004104','BALL FEET',3,0,'1.1.5'),
    ('1510413504','SLEEVE',1,18.03,'1.1.5.1'),
    ('1524809510','ADJUSTABLE BOLT',1,12.82,'1.1.5.2'),
    ('1530411604','BASE',1,7.27,'1.1.5.3')
    -- Mengupdate
    update @BOMStructure
    set TotalPrice = 0
    where PartNumber in
    select PartNumber
    from @BOMStructure
    -- Mengisi Table Total Price
    update @BOMStructure
    set TotalPrice = Price * Qty;
    -- Mengupdate Sub Assy Dan Main Assy di kalikan dengan qty
    WITH cteParents(ItemNumber)
    AS (
    SELECT ItemNumber
    FROM @BOMStructure
    WHERE partnumber in (
    select e1.PartNumber from @BOMStructure e1,@BOMStructure e2
    where e2.ItemNumber > e1 .ItemNumber
    and e2.ItemNumber < e1 .ItemNumber + 'Z'
    and e1 .ItemNumber not like '1'
    and e2 .ItemNumber Not like '1'
    group by e1.PartNumber
    ), cteSource(ItemNumber, TotalPrice)
    AS (
    SELECT p.ItemNumber,
    SUM(COALESCE(s.TotalPrice , 0)) AS TotalPrice
    FROM cteParents AS p
    LEFT JOIN (
    SELECT ItemNumber AS Original,
    CASE
    WHEN ItemNumber LIKE '%.%' THEN ItemNumber
    ELSE '1.' + ItemNumber
    END AS ItemNumber,
    TotalPrice = Price * Qty
    FROM @BOMStructure
    ) AS s ON s.ItemNumber LIKE p.ItemNumber + '.%'
    OR p.ItemNumber = '1'--'0'
    WHERE s.Original NOT IN (SELECT ItemNumber FROM cteParents)
    GROUP BY p.ItemNumber
    UPDATE s
    SET s.TotalPrice = q.TotalPrice * s.Qty
    FROM @BOMStructure AS s
    INNER JOIN cteSource AS q ON q.ItemNumber = s.ItemNumber;
    --Mengupdate Harga Main Assy menggunakan function With
    with cteLevel(Lvl, PartNumber, TotalPrice)
    AS
    select LEN (ItemNumber)- LEN(REPLACE(ItemNumber, '.', ''))as Lvl, PartNumber,TotalPrice from @BOMStructure
    update s
    set s.TotalPrice = (select sum(TotalPrice )from cteLevel as PriceLvl1 where Lvl = 1)
    from @BOMStructure as s
    INNER JOIN cteLevel AS q ON q.PartNumber = s.PartNumber
    where s.ItemNumber = '1'
    update @BOMStructure
    set Price = TotalPrice / Qty
    --Kondisi Part Number yang merupakan Sub Assembly
    where PartNumber in (select e1.PartNumber from @BOMStructure e1,@BOMStructure e2
    where e2.ItemNumber > e1 .ItemNumber
    and e2.ItemNumber < e1 .ItemNumber + 'Z'
    and e1 .ItemNumber not like '1'
    and e2 .ItemNumber Not like '1'
    group by e1.PartNumber )
    update @BOMStructure
    set Price = TotalPrice / Qty
    where ItemNumber = '1'
    select PartNumber, Descript , Qty , Price , TotalPrice , ItemNumber
    from @BOMStructure
    Could some explain me how to solve this problem. 
    Regards,
    Afri

    --select *from tblBOMStructed 
    DECLARE @BOMStructure TABLE (
    PartNumber VARCHAR(14) NOT NULL
    ,Descript VARCHAR(50) NOT NULL
    ,Qty INTEGER NOT NULL DEFAULT 0
    ,Price DECIMAL(10, 2) DEFAULT 0
    ,TotalPrice DECIMAL(10, 2) DEFAULT 0
    ,ItemNumber VARCHAR(14) NOT NULL PRIMARY KEY
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '14300100001029'
    ,'ATMOSPHERIC TANK'
    ,1
    ,0
    ,'1'
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '00150060060005'
    ,'BASIC TANK'
    ,1
    ,0
    ,'1.1'
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '11012142200503'
    ,'SHELL'
    ,1
    ,789.89
    ,'1.1.1'
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '12052140503'
    ,'TOP CONE'
    ,1
    ,226.75
    ,'1.1.2'
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '13052140503'
    ,'BOTTOM CONE'
    ,1
    ,226.75
    ,'1.1.3'
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '140104116508'
    ,'PIPE LEG'
    ,3
    ,39.75
    ,'1.1.4'
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '15004104'
    ,'BALL FEET'
    ,3
    ,0
    ,'1.1.5'
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '1510413504'
    ,'SLEEVE'
    ,1
    ,18.03
    ,'1.1.5.1'
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '1524809510'
    ,'ADJUSTABLE BOLT'
    ,1
    ,12.82
    ,'1.1.5.2'
    INSERT @BOMStructure (
    PartNumber
    ,Descript
    ,Qty
    ,Price
    ,ItemNumber
    VALUES (
    '1530411604'
    ,'BASE'
    ,1
    ,7.27
    ,'1.1.5.3'
    -- Mengupdate 
    UPDATE @BOMStructure
    SET TotalPrice = 0
    WHERE PartNumber IN (
    SELECT PartNumber
    FROM @BOMStructure
    -- Mengisi Table Total Price
    UPDATE @BOMStructure
    SET TotalPrice = Price * Qty;
    -- Mengupdate Sub Assy Dan Main Assy di kalikan dengan qty
    WITH cteParents (ItemNumber)
    AS (
    SELECT ItemNumber
    FROM @BOMStructure
    WHERE partnumber IN (
    SELECT e1.PartNumber
    FROM @BOMStructure e1
    ,@BOMStructure e2
    WHERE e2.ItemNumber > e1.ItemNumber
    AND e2.ItemNumber < e1.ItemNumber + 'Z'
    AND e1.ItemNumber NOT LIKE '1'
    AND e2.ItemNumber NOT LIKE '1'
    GROUP BY e1.PartNumber
    ,cteSource (
    ItemNumber
    ,TotalPrice
    AS (
    SELECT p.ItemNumber
    ,SUM(COALESCE(s.TotalPrice, 0)) AS TotalPrice
    FROM cteParents AS p
    LEFT JOIN (
    SELECT ItemNumber AS Original
    ,CASE 
    WHEN ItemNumber LIKE '%.%'
    THEN ItemNumber
    ELSE '1.' + ItemNumber
    END AS ItemNumber
    ,TotalPrice = Price * Qty
    FROM @BOMStructure
    ) AS s ON s.ItemNumber LIKE p.ItemNumber + '.%'
    OR p.ItemNumber = '1' --'0'
    WHERE s.Original NOT IN (
    SELECT ItemNumber
    FROM cteParents
    GROUP BY p.ItemNumber
    UPDATE s
    SET s.TotalPrice = q.TotalPrice * s.Qty
    FROM @BOMStructure AS s
    INNER JOIN cteSource AS q ON q.ItemNumber = s.ItemNumber;
    --Mengupdate Harga Main Assy menggunakan function With 
    WITH cteLevel (
    Lvl
    ,PartNumber
    ,TotalPrice
    AS (
    SELECT LEN(ItemNumber) - LEN(REPLACE(ItemNumber, '.', '')) AS Lvl
    ,PartNumber
    ,TotalPrice
    FROM @BOMStructure
    UPDATE s
    SET s.TotalPrice = (
    SELECT sum(TotalPrice)
    FROM cteLevel AS PriceLvl1
    WHERE Lvl = 1
    FROM @BOMStructure AS s
    INNER JOIN cteLevel AS q ON q.PartNumber = s.PartNumber
    WHERE s.ItemNumber = '1'
    UPDATE @BOMStructure
    SET Price = TotalPrice / Qty
    --Kondisi Part Number yang merupakan Sub Assembly
    WHERE PartNumber IN (
    SELECT e1.PartNumber
    FROM @BOMStructure e1
    ,@BOMStructure e2
    WHERE e2.ItemNumber > e1.ItemNumber
    AND e2.ItemNumber < e1.ItemNumber + 'Z'
    AND e1.ItemNumber NOT LIKE '1'
    AND e2.ItemNumber NOT LIKE '1'
    GROUP BY e1.PartNumber
    UPDATE @BOMStructure
    SET Price = TotalPrice / Qty
    WHERE ItemNumber = '1'
    SELECT PartNumber
    ,Descript
    ,Qty
    ,Price
    ,TotalPrice
    ,ItemNumber
    ,(LEN(ItemNumber) - LEN(REPLACE(ItemNumber, '.', ''))) as C
    FROM @BOMStructure
    Can you explain logic behind 1 or 1.1 must 1477.00.
    Shridhar J Joshi
    Thanks alot

  • Query issue

    I had query issue on planning layout
    Sold    mat   price   qty   amount
    100      3        5        5          25    layout 1
    100      4       10       5          50    layout2
    when I should removed  material  cal has to come  like this
    100             15        10          75
    but I getting value like
    100        15       10       150
    can u plz tell me how to slove this
    regards
    raju

    Dear Raju,
    In the query, for the Calculated Key Figure (Amount)
       Select properties, enhanced and change to:
                          "BEFORE AGGREGATION"
    It seems to be doing after aggregation, which is  default.
    it is aggregating:
        price = 5+10 = 15
        qty   = 5+5 = 10
        Amount = 15 * 10 = 150
    Good luck, BB

  • Physical query issued by Obiee when cache is on is different and slow

    When the same report runs in OBIEE 10g and cache is OFF it takes less then 1min to get results. If cache is turned ON physical query issued by Obiee is totally different and it takes 2h to get results. Has anyone experienced this with having cache on that some queries are performing poorly.
    Thanks,
    Tatjana

    We are using BI Apps Order Management and Fulfillment Analytics and all tables are cached anyway. Dimensions used are not that huge up to 40K rows. What should I check when it comes to DB query? As I said is different than one generated when cache is disabled although both have the almost the explain plan.

  • Tree Query in htmldb 1.6

    Hi,
    I am a new HTMLDB User, trying to use Tree feature. I am trying to create a tree with the following query, but the tree results in the first record only. Awaiting your valuable response.
    SQL> desc opptable
    Name Type Nullable Default Comments
    OPP_CODE VARCHAR2(20)
    CAM_OPP_CODE VARCHAR2(20) Y
    OPP_SHORT_NAME VARCHAR2(15) Y
    SQL> select * from opptable;
    OPP_CODE CAM_OPP_CODE OPP_SHORT_NAME
    BIGOP BIGOP Big Opportunity
    BIGOPPORTUNITY BIGOPPORTUNITY chk size
    LT01 LT01 laptop
    OPP1 OPP1 opportunity tst
    OPP2 OPP2 soupy snax-OPP
    OPPSA OPPSA Test Opp - SAD
    OPR1 OPR1 test oppr
    REC REC Recruit Ind
    regards

    Hi ,
    Here is the tree query:
    select "OPP_CODE" id,
    "CAM_OPP_CODE" pid,
    "OPP_SHORT_NAME" name,
    null link,
    null a1,
    null a2
    from "#OWNER#"."OPPTABLE"
    regards

  • SQL query issue

    I am attempting to connect to a Progress database using JDBC and am having a few issues with my SQL statement. The code concerned looks like this:
    // Get a statement from the connection
    Statement stmt = conn.createStatement() ;
    // Execute the query
    ResultSet rs = stmt.executeQuery( "SELECT * FROM pub.cust" ) ;
    // Loop through the result set
    while( rs.next() )
    System.out.println( rs.getString( "cust-code" ) ) ;
    That works just fine. Prints out each of the cust-code values. My issue comes when I try to refine the query to be:
    ResultSet rs = stmt.executeQuery( "SELECT * FROM pub.cust WHERE cust.Cust-code='100001-0'" ) ;
    or even
    ResultSet rs = stmt.executeQuery( "SELECT Cust-code FROM pub.cust" ) ;
    Both of these give me an error saying Column not found/specified.
    if I wrap Cust-code in single quotes, the script prints Cust-code on each line, not the value for it. If I escape Cust-code like Cust\-code, I get an Illegal escape character. Any ideas?

    I have never used Progress, but maybe you have to fully qualify the field names like this:
    ResultSet rs = stmt.executeQuery( "SELECT * FROM pub.cust WHERE pub.cust.Cust-code='100001-0'" ) ;
    ResultSet rs = stmt.executeQuery( "SELECT pub.cust.Cust-code FROM pub.cust" ) ;Just a thought.

  • Help needed in resolving query issue

    Hello all,
    Would appreciate any help on the following issue.
    Our process has a stored procedure, which used to take 6 mins to run.
    We are not sure what changed at what level, but now the query goes on forever( till database shuts down or we kill it), and never returns any result. Also, this is not consistent at all times. Sometimes(!!), it brings back results in expected time.
    Apparently nothing changed in the database.
    We checked and the query where it gets stuck is as follows:
    select a.x,
    b.y,
    c,z
    from a,b,c where
    b.header_id =a.header_id and c.property_id =a.property_id(+) and b.status_id in (1,0) and a.date(+)>c.date;
    It does not give any error or any mesg, when it reaches this query, and just hangs in there( Mind this was a working query since last 2 months)
    We are at a total loss at the inconsistent behaviour of this.
    Any help or advise would be greatly appreciated
    Thanks
    Aparajita

    I recommend you to post this as well here:
    Forums Home » Oracle Technology Network (OTN) » Products » Database » SQL and PL/SQL
    Discussion of Oracle SQL and PL/SQL issues
    PL/SQL
    Joel Pérez

  • Oracle Sql Query issue Running on Different DB Version

    Hello All,
    I have come into situation where we are pruning sql queries on different DB version of Oracle and have performance issue. Let me tell you in brief and i really appreciate for your prompt response as its very imperative stuff.
    I have a query which is running on a DB of version 7.3.4 and it takes around 30 mins where as the same query when run on 8i it takes 15sec., its a huge difference. I have run the statistics to analyze on 7.3 and its comparatively very high. Question here is, the sql query trys to select data from same schema table and 2 tables from another DB using DB link and 2 other tables from another DB using DB link.So,how can we optimize this stuff and achieve this run as same time as 8i DB in 7.3. Hope i am clear about my question, Eagerly waiting for your replies.
    Thanks in Advance.
    Message was edited by:
    Ram8

    Difficult to be sure without any more detailed information, but I suspect that O7 is in effect copying the remote tables to local temp space, then joining; 8i is factoring out a better query to send to the remote DBs, which does as much work as possible on the remote DB before shipping remaining rows back to local.
    You should be able to use EXPLAIN PLAN to identify what SQL is being shipped to the remote DB, If you can't (and it's been quite a while since I tried DB links or O7) then get the remote DBs to yourself, and set SQL_TRACE on for the remote instances. Execute the query and then examine the remote trace files, And don't forget to turn off the tracing when you're done.
    Of course it could just be that the CBO got better,,,
    HTH - if not, post your query and plans for the local db, and the remote queries.
    Regards Nigel

  • Adhoc query Issue in IT0001- Additional fields.

    Hi Everyone,
            Im facing issue in adhoc query, In IT0001- Additional field .The supervisor name is not getting displayed in the output  even though personnel number is getting fetched.Output value attributes is  chosen  as 'value and text'.
    Details of the field:
    Name of the field: Personnel number of superior (Org. Manag
    Technical name :SYHR_A_P0001_AF_OMNGR_NR (Additional field)
    This is happening after the implementation of A3 to A9 notes.
    Thanks in Advance.
    Regards,
    S P Joshi.

    Did you try Ted's solution of identifying the "addtional field 'SYHR_A_P0001_AF_OMNGR_NA' "as a displayed field ?
    Note that if that field is not already in your Info-Set, you will have to add it (using t-code sq02).

  • Tabular model with Direct Query issue

    Hi,
    i am creating a tabular model - Direct Query option. I am using a kind of below query to import data,
    Declare @TEST as Table (TestID int, TestName varchar(20))
    Insert into @TEST
    Select 1, 'TEst1' Union
    Select 2, 'TEst2'
    Select * from @TEST
    But the Import fails with an error similar to below,
    OLE DB or ODBC error.  An error occurred while processing the partition 'Query_``````````' in table 'Query_````````'.  The current operation was cancelled because another operation in the transaction failed.
    Any idea, why it is failing ? or is it like we shouldn't use declare statement in the Query area ?
    Please reply ...Thanks in advance !
    --------------------------- Radhai Krish | Golden Age is no more far | --------------------------

    I'm pretty sure that the query would have to be a single statement so the declare statement would be causing issues.
    So just doing this as a single union query should work:
    Select 1 as TestID, 'TEst1' as TestName Union
    Select 2, 'TEst2'
    http://darren.gosbell.com - please mark correct answers

  • With clause query issue in oracle cloud script editor

    When I am running this query in SQL Workshop > SQL Commands window then its working fine
    with cte as (select * from emp)
    select * from cte
    where deptno = (select deptno from dept where loc = 'DALLAS')
    but its give me error in SQL Workshop > Script Editor window
    When I did copy & paste query from Script Editor window to notepad,
    then I realize that its automatically adding hidden "?" question mark (as per below query)
    how can I resolve this issue?
    please guide me.
    I have confirm that there is no any white space after 'DALLAS')
    & another simple queries working fine in both windows.
    with cte as (select * from emp)
    select * from cte
    where deptno = (select deptno from dept where loc = 'DALLAS')?
    Edited by: Sanjay on 28 Mar, 2013 6:46 PM

    Hi Sanjay,
    You have mentioned "+but its give me error in SQL Workshop > Script Editor window+" - are you referring to the SQL Workshop > SQL Scripts > Script Editor option, while editing a SQL script? If so, then I have been unable to reproduce the behaviour you have reported, and have not received any errors using your test query.
    To assist in identifying the cause of your problem, could you please outline the exact steps that you followed, leading up to the step where you receive an error?
    Regards,
    Hilary

  • Af:query issues within a taskflow

    JDev: 11.1.2.1
    I've created a simple fusion app, using the HR countries and department tables. The ViewController contains a home page and a taskflow.
    The taskflow accepts a 'SearchBy' parameter, and I have a router (default) which then redirects the user to one of two pages, based on that parameter.
    <case id="__1">
    <expression>#{pageFlowScope.SearchBy eq 'countries'}</expression>
    <outcome>countries</outcome>
    </case>
    <case id="__2">
    <expression>#{pageFlowScope.SearchBy eq 'depts'}</expression>
    <outcome>depts</outcome>
    </case>
    The two pages "CountriesQueryPage" and "DeptsQueryPage" contain nothing more than a standard af:query (with table) based on the named criteria "All Queriable Attributes" for respective views.
    The Home page contains the taskflow above as a region, and a couple of links, which set a #{requestScope.SearchBy} parameter. The taskflow binding was changed to Refresh 'ifNeeded'.
    <af:panelHeader text="panelHeader 1" id="ph1">
    <f:facet name="context"/>
    <f:facet name="menuBar"/>
    <f:facet name="toolbar">
    <af:group id="g1">
    <af:commandLink text="Countries" id="cl1" partialSubmit="true">
    <af:setPropertyListener from="#{'countries'}" to="#{requestScope.SearchBy}"
    type="action"/>
    </af:commandLink>
    <af:spacer width="10" height="10" id="s1"/>
    <af:commandLink text="Depts" id="cl2" partialSubmit="true">
    <af:setPropertyListener from="#{'depts'}" to="#{requestScope.SearchBy}"
    type="action"/>
    </af:commandLink>
    </af:group>
    </f:facet>
    <f:facet name="legend"/>
    <f:facet name="info"/>
    <af:region value="#{bindings.tf11.regionModel}" id="r1" partialTriggers="::cl1 ::cl2"/>
    </af:panelHeader>
    When I run this, the default "countries" page is displayed in the region. The af:query functions perfectly. When I click the link to the Depts page, the region refreshes as expected, but when the query table is rendered an error is thrown "Content failed to load.... data transmission was interrupted. Checking the log, I'm getting....
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
    java.lang.IllegalStateException: Could not find component to stream
    <FaceletViewHandlingStrategy> <handleRenderException> Error Rendering View[Home]
    java.lang.IllegalStateException: Could not find component to stream
    Couldn't find much online about this error message.
    The only way I've been able to stop the issue is to remove the af:table on the depts query page.
    I also tried using a dynamic region to get the above functionality (dividing each query page into it's own taskflow and removing the router) and got exactly the same issue.
    Any ideas?
    Thanks
    Edited by: drb on Nov 24, 2011 6:31 PM

    Just in case anyone else has this issue -:
    It turns out that the fault was using RequestScope parameters within the af:setPropertyListener. Once I changed this to a longer scope, pageFlowScope for example, the issue was resolved.

Maybe you are looking for

  • Filenet connection with java api not working

    I have written the following code to connect content engine and process engine.. MY content engine is connected fine and good...But process engine is not connecting code: public String PE_CONNECTION_POINT      = "PEConnection"; public Connection ceCo

  • BPM Scenario: Message has error status on outbound side

    Hi All,         I am doing one BPM scenario. In my scenario i am collecting 12 different type of idocs in BPM and bundling these idocs and sending these to the 12 different files.         If i send 12 idocs from the R/3 then my scenario is working pe

  • Error trying to start wmii 3.5

    I receive the following error when trying to run wmii as a  non-root user: Cannot creats ns_path /tmp/ns.<userName>  Permission denied. Looks like something in wmii is trying to create a file  in /tmp.   What do I need to do to  run wmii as a normal

  • Unable to write to Seagate Backup Plus drive on Mac

    I just installed a brand new Seagate Backup Plus drive on my laptop with the goal of being able to use it on Macs and PCs.Seagate's web site says this: Using the drive under MacOS and Windows If you want to use the drive under Windows and MacOS, simp

  • Silverlight won't run

    When trying to stream a movie from Netflix using Safari, I get the whirling circle that tells me that the processor is attempting to do something. But it appears that Silverlight isn't working properly.  I have removed the program, emptied trash, rei