Dynamic Filter on Hierarchical Column

I have a parent-child hierarchy in my 11g Subject Area. I know it is possible to filter the hierarchical column using the Selection Steps and the “Select Members based on Hierarchy” option. But is it possible to dynamically filter the column using a Session Variable?
My hierarchy is set up using the company’s department structure. The business need is for a line manager to have access only to data for their own departments, and any departments below in the hierarchy where applicable. A session variable in the repository knows who has logged onto OBI, and returns the relevant departments. Is it possible to use this variable to only display the relevant portion of the hierarchy?
Thanks.

Yes this is possible through external table authorization. Lets say you have hierrarchy table with different nodes in data warehouse. Lets consider w_hierarchy_d table for instance which has different columns like hier1_code, hier2_code etc. Create an external table with three different columns, username, hierarchynode, hierarchyvalue. Hierarchynode, gives the information on what level of hierarchy the user should be restricted, and the hierarchyvalue gives the actual value of the node user belongs to. Lets take a simple geography hierarchy as example;
username hierarchynode hierarchyvalue
user1 hier1_code Asia - Region
user2 hier3_code florida - Office
Using init block populate this data into session variables and create a filter on group/role like below:
case when valueofnqsessionhiernode='hier1_code' then officetable.region
when valueofnqsessionhiernode='hier3_code' then officetable.office
end = valueofnqsessionhiervalue.
I am positive the above model works as we implemented this before.
Please Award points if helpful.
Thanks,
-Amith.

Similar Messages

  • Is it possible to view the content of multiple lists(located in multiple webs) in one ListViewWebpart? And how can I filter a multivalue column?

    Is it possible to view the content of multiple lists, that are located in different webs as well, in just one ListViewWebpart? Could I maybe change the query programmatically so that it get's the content this way?
    I know that I could use the Content Query Webpart instead - actually I have been using that so far, but the problem is, that it brings no standard Sharepoint functionality for lists with it... I had to write the xsl style sheet, there are no dynamic filters
    that the user could set, there are no default list operations the user could use.
    The ListViewWepart has all of these, but it only shows the content of one list...
    And my second problem:
    One column can contain multiple values (like a column that contains multiple users or user groups that are related to one entry). I can filter every other column with the standard filters, but not the column with multiple values in it. Is it possible to
    activate that or maybe add this feature programmatically?

    You can fetch data from multiple lists in ListViewWebpart, this can be possible through Content Query web part or Custom Web Part using visual studio but in that case you can not get the standard SharePoint funcationality for list (which is available in
    ListViewWebparts).
    No OOB filter available for multi-choice column, you also have to go with custom solution to achieve this.
    Adnan Amin MCT, SharePoint Architect | If you find this post useful kindly please mark it as an answer.

  • PPS dynamic filter creation - not your normal thing but we need a solution, dont think Performance Point can handle it!

    My challenge at the moment is that I need to create a dynamic filter. To explain this is a cascading filter but not your normal cascading filter,
    ie, Year/Month/day etc.
    Here we have a single Dimension, Organisation. It contains every level of a business,
    Site,
    Dept, 
    Company name,
    Division
    Holding
    Strategic Area
    From these as a default we have 4 built hierarchies with a different combination of the above.
    Activity (Strategic Area, Dept)
    Organisation (company Name, site, Dept)
    Sites (Division, Site)
    Holdings(Holding, Strategic Area, site, Dept)
    At any given time we have have additional Hierarchies created within the Dimension, further adding to the hierarchy list.
    We now have a challenge where we require our users to be able to in the first filter select the Hierarchy they want to use, ie, Holdings, Site, Organisation
    or Activity. This should then cascade to the second filter and contain the relevant hierarchy and levels as a multi select filter. Of course this also needs to be connected to number of graphs, charts and scorecards on the page, dynamically. 
    I have gone around the houses to get this to work but not having any luck. Tried the variety of filters available, MDX, member selection, tabular,
    SharePoint, and attempted to mix and match to get this to work. I cannot find a way but I don't believe this is not possible.
    If it is not possible we must look around for another front end solution for our BI Dashboards which I would prefer to avoid. Any response or suggestion
    would be much appreciated.
    Regards,
    Sheb

    Hi Sheb,
    Please check the articles below and see if cascading filter in PerformancePoint Dashboard can be help:
    http://technet.microsoft.com/en-us/library/hh272541(v=office.15).aspx
    http://www.dotnetcurry.com/showarticle.aspx?ID=872
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Materialized view with dynamic filter

    I have a query which has a dynamic filter in the where clause. Dynamic in the sense, the value in the where condition will be obtained only when the query is run.
    The user interface is Business Objects tool i am using, based on the user login variable, the query is formed. Is there a possibilty to create a materialized view using this query.
    The query looks like this. The part in BOLD section is the filter. This query is taking long time and hence i am going for materialized view. Please suggest a solution
    SELECT
    DM_SALES.SALES_ORG_DIM.POSITION_LEVEL_5_DESC,
    SUM(case when PERIOD_DIM.FISCAL_PERIOD_NBR = ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_PERIOD_NBR ) and PERIOD_DIM.FISCAL_YEAR=( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR ) then SALES_FACT.NET_SALES_USD else 0 end),
    SUM(case when PERIOD_DIM.FISCAL_PERIOD_NBR= ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_PERIOD_NBR ) and PERIOD_DIM.FISCAL_YEAR=( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR )-1 AND PERIOD_DIM.FISCAL_DAY_IN_PERIOD BETWEEN 1 AND ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_DAY_IN_PERIOD ) then SALES_FACT.NET_SALES_USD else 0 end),
    SUM(case when
    PERIOD_DIM.FISCAL_YEAR=( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR ) then SALES_FACT.NET_SALES_USD else 0 end),
    SUM(case when PERIOD_DIM.FISCAL_YEAR= ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR )-1
    AND PERIOD_DIM.FISCAL_DAY_IN_YEAR BETWEEN 1 AND ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_DAY_IN_YEAR )
    then SALES_FACT.NET_SALES_USD else 0 end),
    SUM(case when PERIOD_DIM.FISCAL_PERIOD_NBR = ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_PERIOD_NBR )and PERIOD_DIM.FISCAL_YEAR=( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR ) then SALES_FACT.MUNITS_SOLD_QTY else 0 end),
    SUM(case when PERIOD_DIM.FISCAL_PERIOD_NBR= ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_PERIOD_NBR ) and PERIOD_DIM.FISCAL_YEAR=( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR )-1 AND PERIOD_DIM.FISCAL_DAY_IN_PERIOD BETWEEN 1 AND ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_DAY_IN_PERIOD ) then SALES_FACT.MUNITS_SOLD_QTY else 0 end),
    SUM(case when
    PERIOD_DIM.FISCAL_YEAR=( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR ) then SALES_FACT.MUNITS_SOLD_QTY
    else 0 end),
    SUM(case when PERIOD_DIM.FISCAL_YEAR= ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR )-1 AND PERIOD_DIM.FISCAL_DAY_IN_YEAR BETWEEN 1 AND ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_DAY_IN_YEAR )
    then SALES_FACT.MUNITS_SOLD_QTY else 0 end),
    SUM(case when PERIOD_DIM.FISCAL_PERIOD_NBR = ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_PERIOD_NBR ) and PERIOD_DIM.FISCAL_YEAR= ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR ) then
    SALES_FACT.CASES_SOLD_QTY else 0 end),
    SUM(case when PERIOD_DIM.FISCAL_PERIOD_NBR= ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_PERIOD_NBR )and PERIOD_DIM.FISCAL_YEAR=( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR )-1 AND PERIOD_DIM.FISCAL_DAY_IN_PERIOD BETWEEN 1 AND ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_DAY_IN_PERIOD ) then SALES_FACT.CASES_SOLD_QTY else 0 end),
    SUM(case when
    PERIOD_DIM.FISCAL_YEAR=( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR ) then SALES_FACT.CASES_SOLD_QTY
    else 0 end),
    SUM(case when PERIOD_DIM.FISCAL_YEAR= ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR )-1 AND PERIOD_DIM.FISCAL_DAY_IN_YEAR BETWEEN 1 AND ( DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_DAY_IN_YEAR )
    then SALES_FACT.CASES_SOLD_QTY else 0 end),
    DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR,
    DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_MONTH_NAME,
    DM_SALES.SALES_ORG_DIM.POSITION_LEVEL_6_DESC,
    DM_SALES.SALES_ORG_DIM.POSITION_LEVEL_7_DESC,
    DM_SALES.SALES_ORG_DIM.POSITION_LEVEL_8_DESC,
    CONCAT (CONCAT(SHIP_TO_CUST_DIM.SOURCE_CUST_NBR,'-'),SHIP_TO_CUST_DIM.SOLD_TO_CUST_NAME),
    CONCAT (CONCAT(SHIP_TO_CUST_DIM.SOURCE_CUST_NBR,'-'),SHIP_TO_CUST_DIM.SHIP_TO_CUST_LOC_NAME)
    FROM
    DM_SALES.SALES_ORG_DIM,
    PERIOD_DIM,
    SALES_FACT,
    DM_SALES.CURRENT_DATE_PERIOD_DIM,
    SHIP_TO_CUST_DIM
    WHERE
    ( SALES_FACT.INVOICE_DATE_KEY(+)=PERIOD_DIM.PERIOD_KEY )
    AND ( SHIP_TO_CUST_DIM.SHIP_TO_CUST_KEY=SALES_FACT.SHIP_TO_CUST_KEY )
    AND ( SALES_FACT.SALES_ORG_KEY=DM_SALES.SALES_ORG_DIM.SALES_ORG_KEY )
    AND ( PERIOD_DIM.PERIOD_KEY<=DM_SALES.CURRENT_DATE_PERIOD_DIM.PERIOD_KEY )
    AND
    ( DM_SALES.SALES_ORG_DIM.POSITION_LEVEL_5_DESC=(SELECT DM_SALES.SECURITY_HEADER.SALES_ORG_POSITION_DESC from DM_SALES.SECURITY_HEADER
    WHERE DM_SALES.SECURITY_HEADER.BOLOGIN = @VARIABLE('BOUSER')) ) AND
    ( PERIOD_DIM.FISCAL_YEAR>=DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR-1 )
    GROUP BY
    DM_SALES.SALES_ORG_DIM.POSITION_LEVEL_5_DESC,
    DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_YEAR,
    DM_SALES.CURRENT_DATE_PERIOD_DIM.FISCAL_MONTH_NAME,
    DM_SALES.SALES_ORG_DIM.POSITION_LEVEL_6_DESC,
    DM_SALES.SALES_ORG_DIM.POSITION_LEVEL_7_DESC,
    DM_SALES.SALES_ORG_DIM.POSITION_LEVEL_8_DESC,
    CONCAT (CONCAT(SHIP_TO_CUST_DIM.SOURCE_CUST_NBR,'-'),SHIP_TO_CUST_DIM.SOLD_TO_CUST_NAME),
    CONCAT (CONCAT(SHIP_TO_CUST_DIM.SOURCE_CUST_NBR,'-'),SHIP_TO_CUST_DIM.SHIP_TO_CUST_LOC_NAME)

    You could potentially create a single materialized view that had no restriction on the BOLOGIN column and allow Oracle to use that materialized view to be used to satisfy requests from the different users. You may need to add appropriate indexes to the materialized view for that to be a reasonable option, depending on how many distinct BOLOGIN values you expect.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to set a dynamic filter to a prompted one?

    Hello:
    I have a dashboard prompt whose values determine the columns for a constructed dynamic filter column using case statement.
    There is another dashboard prompt whose value determine the the values for the dynamic filter column.
    I have a need to set this dynamic filter to the operator 'is prompted'. According to the OBIEE documentation, the requirement for 'is prompted' filter is to have the dashboard prompt column match with the filter column.
    I currently use a presentation variable for the dashboard prompt column that gives the filter value.
    How do I make my dynamic filter to be prompted (for pre-filtering results as a default behavior) and subsequently use the presentation variable (derived from the dashboard prompt) if a user enters the appropriate prompt values?
    Here is an example:
    Dashboard prompt: Location Type-> (State, District, City) (The case statement on my filter determines the appropriate logical column State or District or City)
    Filter Value: Dallas (pv1)
    The dynamic filter will generate "City" = '@{pv1}' (Dallas in the above example)
    I want this dynamic filter to be set to 'is prompted' for pre-filtering results as a default behavior.
    Thanks for reading this far and looking forward to your suggestions.
    Regards
    Sankar Bala

    Please read this carefully, you may find what you are looking for:
    Dynamic dashboard prompts and columns used in multifunctional report, full guided navigation
    http://108obiee.blogspot.com/2009/08/dynamic-dashboard-prompts-and-columns.html
    Or this one:
    http://obiee101.blogspot.com/2009/04/obiee-dynamic-prompt-content.html
    Regards
    Goran
    http://108obiee.blogspot.com

  • How to access sort direction and filter value of columns?  Can I catch the 'filtered' or 'sorted' event?

    We have some columns being added to a table.  We have set the sortProperty and the filterProperty on each of our columns.
    This allows us to both filter and sort.
    We want to be able to access the columns filter value and sort value after the fact.  Can we access the table and then the columns and then a columns properties to find these two items?  How can I access the sort direction and filter value of columns?
    We would also like to store the filter value and the sort direction, and re-apply them to the grid if they have been set in the past.  How can we dynamically set the filter value and sort direction of a column?
    Can I catch or view the 'filtered' or 'sorted' event?  We would like to look at the event that occurs when someone sorts or filters a column.  Where can I see this event or where can i tie into it, without overwriting the base function?

    Hey everyone,
    Just wanted to share how I implemented this:
    Attach a sort event handler to table - statusReportTable.attachSort(SortEventHandler);
    In this event handler, grab the sort order and sorted column name then set cookies with this info
    function SortEventHandler(eventData)
        var sortOrder = eventData.mParameters.sortOrder;
        var columnName = eventData.mParameters.column.mProperties.sortProperty;
        SetCookie(sortDirectionCookieName, sortOrder, tenYears);
        SetCookie(sortedColumnCookieName, columnName, tenYears);
    Added sortProperty and filterProperty to each column definition:
    sortProperty: "ColName", filterProperty: "ColName",
    When i fill the grid with data, i check my cookies to see if a value exists, and if so we apply this sort:
    function FindAndSortColumnByName(columnName, sortDirection (true or false))
        var columns = sap.ui.getCore().byId('statusReportTable').getColumns();
        var columnCount = columns.length;
        for(var i = 0; i < columnCount; i ++)
            if(columns[i].mProperties.sortProperty == columnName)
                columns[i].sort(sortDirection);

  • Filter Function in Column Formula is not working properly

    Hi,
    I am using Filter Function in Column formula tab in Answers to calculate the Total sum from the start of the Fiscal month to the Month selected from the Prompt.
    My requirement is I have total sales column. Now I need to calculate TYYTD kind of thing for which I cant use the Time sereis due to my report constraint.
    Instead of that I am using this Filter function on TYYTD column where i am giving the filter as start of the Fiscal month to the month selected from the Prompt.
    For example if I select May month from the Prompt then this TYYTD column should give me SUM(Total Sales) between Feb and May for which I am using the Filter Function. But it giving me only May sales whcih is same as Total Sales column.
    Can anyone throw some light on this as this is very important for us or any alternate solution other than Time sereis measures.
    Did anyone got this kind of issue with Filter Function?
    Regards,
    Azad

    Ok...here's the steps to fix this as efficiently as possible.  I have a whole bunch of mailboxes under "On My Mac" and they have a bunch of mailboxes nested in them.  I get my messages into Apple Mail via IMAP.  (I don't know if this matters.)  The steps below assume you have a similar setup.
    1.  Hold the Option key down and click the dropdown arrow next to each mailbox that has one.  This will cause all nested mailboxes below it to appear.
    2.  Go to the top of the list of mailboxes under "On My Mac" and highlight the first mailbox.  Then hold the Shift key down and highlight the last mailbox in the list.  This will cause all of the mailboxes and nested mailboxes to be highlighted.
    3.  From the menu, select "Mailbox --> Rebuild" and the rebuild process will start.
    4.  Watch the top of the mail screen to see the message count change as the mailboxes are being rebuilt.  Wait until the activity stops before doing the next step.
    5.  As the mailboxes were rebuilt, many messages were reset as "Unread" even though every message was previously "Read."  Make sure the mailboxes you want to affect are still highlighted.  Right-click and select "Mark All Messages Read."
    That fixed the problem for me.

  • Dynamic Table with two columns

    Hi!
    i have to create a Dynamic Table with two columns having 5-5 links each with some text...... three links r based on certain conditions....they r visible only if condition is true...
    if the links r not visible in this case another links take it's place & fill the cell.
    links/text is coming from database.
    i am using Struts with JSP IDE netbeans
    Please help me
    BuntyIndia

    i wanna do something like this
    <div class="box_d box_margin_right">
              <ul class="anchor-bullet">
              <c:forEach items="${data.faqList}" var="item" varStatus="status"
                        begin="0" end="${data.faqListSize/2-1}">
                        <li>${item}</li>
                   </c:forEach>
              </ul>
              </div>
              <div class="box_d">
              <ul class="anchor-bullet">
              <c:forEach items="${data.faqList}" var="item" varStatus="status"
                        begin="${data.faqListSize/2}" end="${data.faqListSize}">
                        <li>${item}</li>
                   </c:forEach>
              </ul>
              </div>
    wanna divide table in two columns....if one link got off due to condition other one take it's position...
    I have created a textorderedlist
    Bunty

  • Collapse action doesn't work when several hierarchical columns in a report

    Hello everyone!
    I have an analysis which contains 6 hierarchical columns. And the problem is that for the 5th and 6th columns collapse doesn't work. I can easily expand the column, but I can't collapse it back. The first four columns are collapsing fine. Is there a bug which describes this?
    I'm using OBIEE 11.1.1.6.7. Tried to check this issue in Mozilla and IE - collapse didn't work in neither of them.

    It doesn't work here either. After checking the italicized bit below, I see that it doesn't work when called by an application either. It looks like a bug.
    Here's the fix I found here. Put it in the automator action "run Applescript"
    http://bbs.applescript.net/viewtopic.php?id=15292
    on run {input, parameters}
    --Pop Box
    display dialog "Automator hosed me with a bug, so I'm making you wait for 5 secs with delicious Applescript." giving up after 5
    return input
    end run
    The non-working solution :P
    One suggestion - split the workflow into two (or more) parts.
    1. Open Finder Items with Default Application
    2. Ask for Confirmation
    3. Run Workflow
    4. Wait for User Action
    5. Open Finder Items with Specific Application
    Save the first as an app, the second as a workflow.
    BG3, G4QS, G4ALPB   Mac OS X (10.4.3)  

  • Dynamic name in formula column header

    Greetings, i have a question - is it possible to create dynamic header of formula column?
    For example - year on the form is 2012? in the header i want something like ratio "current year picked from forms year" to "current year -1", i.e. ratio 2012 to 2011
    Is it possible?

    It looks like forms are not supporting text functions like FR yet, I gave it a try <<MemberName("<Formname>","<POV DIM Name>)>> in the formula header area and it didn't like it. It is just displaying what ever I typed in there.

  • How to generate report with dynamic variable number of columns?

    How to generate report with dynamic variable number of columns?
    I need to generate a report with varying column names (state names) as follows:
    SELECT AK, AL, AR,... FROM States ;
    I get these column names from the result of another query.
    In order to clarify my question, Please consider following table:
    CREATE TABLE TIME_PERIODS (
    PERIOD     VARCHAR2 (50) PRIMARY KEY
    CREATE TABLE STATE_INCOME (
         NAME     VARCHAR2 (2),
         PERIOD     VARCHAR2 (50)     REFERENCES TIME_PERIODS (PERIOD) ,
         INCOME     NUMBER (12, 2)
    I like to generate a report as follows:
    AK CA DE FL ...
    PERIOD1 1222.23 2423.20 232.33 345.21
    PERIOD2
    PERIOD3
    Total 433242.23 56744.34 8872.21 2324.23 ...
    The TIME_PERIODS.Period and State.Name could change dynamically.
    So I can't specify the state name in Select query like
    SELECT AK, AL, AR,... FROM
    What is the best way to generate this report?

    SQL> -- test tables and test data:
    SQL> CREATE TABLE states
      2    (state VARCHAR2 (2))
      3  /
    Table created.
    SQL> INSERT INTO states
      2  VALUES ('AK')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AL')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AR')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('CA')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('DE')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('FL')
      3  /
    1 row created.
    SQL> CREATE TABLE TIME_PERIODS
      2    (PERIOD VARCHAR2 (50) PRIMARY KEY)
      3  /
    Table created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD1')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD2')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD3')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD4')
      3  /
    1 row created.
    SQL> CREATE TABLE STATE_INCOME
      2    (NAME   VARCHAR2 (2),
      3       PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
      4       INCOME NUMBER (12, 2))
      5  /
    Table created.
    SQL> INSERT INTO state_income
      2  VALUES ('AK', 'PERIOD1', 1222.23)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('CA', 'PERIOD1', 2423.20)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('DE', 'PERIOD1', 232.33)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('FL', 'PERIOD1', 345.21)
      3  /
    1 row created.
    SQL> -- the basic query:
    SQL> SELECT   SUBSTR (time_periods.period, 1, 10) period,
      2             SUM (DECODE (name, 'AK', income)) "AK",
      3             SUM (DECODE (name, 'CA', income)) "CA",
      4             SUM (DECODE (name, 'DE', income)) "DE",
      5             SUM (DECODE (name, 'FL', income)) "FL"
      6  FROM     state_income, time_periods
      7  WHERE    time_periods.period = state_income.period (+)
      8  AND      time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
      9  GROUP BY ROLLUP (time_periods.period)
    10  /
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> -- package that dynamically executes the query
    SQL> -- given variable numbers and values
    SQL> -- of states and periods:
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3    TYPE cursor_type IS REF CURSOR;
      4    PROCEDURE procedure_name
      5        (p_periods   IN     VARCHAR2,
      6         p_states    IN     VARCHAR2,
      7         cursor_name IN OUT cursor_type);
      8  END package_name;
      9  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY package_name
      2  AS
      3    PROCEDURE procedure_name
      4        (p_periods   IN     VARCHAR2,
      5         p_states    IN     VARCHAR2,
      6         cursor_name IN OUT cursor_type)
      7    IS
      8        v_periods          VARCHAR2 (1000);
      9        v_sql               VARCHAR2 (4000);
    10        v_states          VARCHAR2 (1000) := p_states;
    11    BEGIN
    12        v_periods := REPLACE (p_periods, ',', ''',''');
    13        v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
    14        WHILE LENGTH (v_states) > 1
    15        LOOP
    16          v_sql := v_sql
    17          || ',SUM(DECODE(name,'''
    18          || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
    19          || '"';
    20          v_states := LTRIM (SUBSTR (v_states, 3), ',');
    21        END LOOP;
    22        v_sql := v_sql
    23        || 'FROM     state_income, time_periods
    24            WHERE    time_periods.period = state_income.period (+)
    25            AND      time_periods.period IN (''' || v_periods || ''')
    26            GROUP BY ROLLUP (time_periods.period)';
    27        OPEN cursor_name FOR v_sql;
    28    END procedure_name;
    29  END package_name;
    30  /
    Package body created.
    SQL> -- sample executions from SQL:
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR                                                        
    PERIOD1       1222.23                                                                              
    PERIOD2                                                                                            
                  1222.23                                                                              
    SQL> -- sample execution from PL/SQL block
    SQL> -- using parameters derived from processing
    SQL> -- cursors containing results of other queries:
    SQL> DECLARE
      2    CURSOR c_period
      3    IS
      4    SELECT period
      5    FROM   time_periods;
      6    v_periods   VARCHAR2 (1000);
      7    v_delimiter VARCHAR2 (1) := NULL;
      8    CURSOR c_states
      9    IS
    10    SELECT state
    11    FROM   states;
    12    v_states    VARCHAR2 (1000);
    13  BEGIN
    14    FOR r_period IN c_period
    15    LOOP
    16        v_periods := v_periods || v_delimiter || r_period.period;
    17        v_delimiter := ',';
    18    END LOOP;
    19    v_delimiter := NULL;
    20    FOR r_states IN c_states
    21    LOOP
    22        v_states := v_states || v_delimiter || r_states.state;
    23        v_delimiter := ',';
    24    END LOOP;
    25    package_name.procedure_name (v_periods, v_states, :g_ref);
    26  END;
    27  /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR         CA         DE         FL                       
    PERIOD1       1222.23                           2423.2     232.33     345.21                       
    PERIOD2                                                                                            
    PERIOD3                                                                                            
    PERIOD4                                                                                            
                  1222.23                           2423.2     232.33     345.21                       

  • Sort order and hierarchical columns

    I have a report with a hierarchical column (say total, country, city), another dimension (say outdated, actual, undecided) and a measure. In the report should show the results grouped, sorted by the hierarchical column. So i configured the report to be sorted by column one.
    But if i click on the + in front of total, i get
    + total actual 200
    ...... outdated 400
    ...... undecided 700
    +france         actual          150
    +germay        actual          50
    +france         outdated     300
    +germany      outdated     100
    +france         undecided    300
    +germany      undecided    400
    instead of
    +total  actual          200
    ...... outdated 400
    ...... undecided 700
    + france actual 150
    ...... outdated 300
    ...... undecided 300
    + germany actual 50
    ...... outdated 100
    ...... undecided 400
    Is there a possibility to get the second version?
    Thanks
    Martin

    Ok, this one is on me. The reason for this behaviour is:
    The country field has a sort field defined, but (we are still in development) this is allways zero, therefore OBI sorts by zero and assumes, the column is sorted now...

  • Error when including hierarchical column in repot

    Hi All,
    I am getting following error [nQSError: 42039] Columns in BY clause of REPORT totalling function must be in select list. (HY000) when i include the Hierarchical column, Is it something i should set for it.
    Thanks,
    Sreekanth

    Hi,
    Problem was not with hierarchy column, but with another column which i used to sort the entire report on (fiscal_priod_number), and fiscal_period_number column was in excluded section in the pivot, once i dragged the column to pivot section and hide it from colum properties hide property report is functioning normally, This is something intresting behaviour, and this happens only with reports which use hierarchy column.
    Thanks,
    Sreekanth

  • How to add a dynamic filter in query panel

    I want to display the data in recent week, is it possible to add a dynamic filter in query panel?
    eg. filter--> actionDate >= CurrentDate - 7
    BO version: BOX I 3.1

    We are still trying to get this filter to work. Can anybody give us an example of how it should look on the sensor?
    The sensor filter that we would like to create should “exclude” any source IP, any source port to specific destination hosts on all destination ports (icmp has none) from capturing events and storing them in the event store on the sensor.
    This is the filter that we have so far on the sensor. What’s the problem with it?
    service event-action-rules rules0
    filters edit icmp-w-echo-filter-sensor-sensor-0-D
    signature-id-range 2100
    subsignature-id-range 0-255
    attacker-address-range 0.0.0.0-255.255.255.255
    victim-address-range a.b.c.x,a.b.c.y
    attacker-port-range 0-65535
    victim-port-range 0-65535
    risk-rating-range 0-100
    no actions-to-remove
    deny-attacker-percentage 100
    filter-item-status Enabled
    stop-on-match False
    no user-comment
    exit
    filters move icmp-w-echo-filter-sensor-sensor-0-D begin
    exit

  • How to retrieve dynamic filter value submitted from control query to .....

    How to retrieve dynamic filter value submitted from control query to broadcast query.....
    I'm trying to change the hierarchy version determined by a userexit variable in the broadcast query.
    The Hierarchy Version should be dependent on the input filter delivered by the bursting query.
    But how do I catch the dynamic filter value which has been submitted by the bursting query,
    with other words:  where does the bursting query store it's out put while sequentially starting the broadcast query value by value?
    BTW: the filter value from the bursting query appears under "dynamic filter values" in the information of the broadcast query...
    Any thoughts are welcome!
    Edited by: Heinrich Krupp on Jun 24, 2009 1:25 PM

    Further information,
    Report is used via webi only, not Xcelsius or Dashboard.
    Report is consuming BI Web Services.
    Although we can pass in prompt values to BI Services, I couldn't find if we could pass a variable or dimension object into this field. Anyone knows?

Maybe you are looking for

  • Query Engine Error when adding to repository.

    I'm using Crystal 9.  I am trying to using the Add Command function as a datasource from an ODBC connection.  The SQL is straightforward. Select dbo.CDS_STATDAY.Meta_ID From dbo.CDS_STATDAY I get an error when I select the "Add to Repository" checkbo

  • HT204409 My iphone5 connect to my wifi router but my wife's will not

    My iPhone connect perfectly to my wireless router but my wife's will not, I have tried connecting her phone to a friends wireless....still will not connect...I have tried turning wifi off and back on again....still nothing....tried turning phone off

  • Only backups offered by TM for a full restore are two weeks old.

    I just tried to do a full restore from Time Machine, booted from the install disk. When it got to the "chose which back up" step it only offered me three backups, from the 4th, 5th and 6th October. The TM drive is an external USB connected directly a

  • Double page view broken in acroread 8

    If choosing the double page view (side by side view) in former versions of Acrobat Reader, it started the first page on the right side and showed two pages on subsequent pages. This corresponded to the typical case in books where the odd page is alwa

  • Prevent iPhoto from opening when iPhone is connected?

    Does anyone know if there is a way to keep iPhoto from opening when my iPhone is connect BUT do the opposite when my digital still cam is connected? I like having iPhone auto-launch for my canon cam, but not when I connect the iPhone.