Dynamic column selection based on login in BI Answers

Hi
I have a dimension with manager level 1 to 10, based on the user login, I want to display the table with the column (level 1 or level n) dynamically ( ex: if the user is in manager level n, display column level n with other data in the table). P.S. there are more than 10000+ users, so I can't customize each user.
can you please let me know if this is possible and how to do it?
Thanks a lot,

You might use the indexcol function for this purpose.
http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_SQL15.html
In the document, you have a hierarchy example.
Success
Nico

Similar Messages

  • Dynamic row selection based on Page member selection in Planning web-form

    Hello experts
    I have requirement where, user dont want 10 webforms to enter 2 accounts line for various sparse members. Below is the dimension detail and web-form current design
    Account - Dense
    Period - Dense
    Year - Sparse
    Scenario - Sparse
    Version - Sparse
    Entity - Sparse
    Product - Sparse (600 level 0 members)
    Product dim has family1 as parent and 40 level 0 mem like that there are 10 family level 1 members, now to enter account member (only 2 member) for 6 years projection ( it means 12 periods and 6 years in column ) , i can build 10 web-forms with one web-form has one family level-0 mem in rows,
    however my question, is how can i achieve this in one web-form, instead of 10 web-forms for 400 products ?
    your help is greatly appreciated.
    Edited by: 859874 on Jul 18, 2012 8:58 PM

    Im not sure there is any simple way to get dynamic row selection based on what is selected in the page.
    If I were designing the form based on what you have stated, I would probably stick both Account and Year in the page, and the 400 products in rows. This would require the user to select the different combinations of Year / Account, but would mean only 12 columns (instead of 72).
    Alternatively you could stick Account in rows too - meaning 800 rows, but less combinations to select in Page....all depends what is deemed acceptable to the user.
    Probably other approaches that may be better than above (put Product in the Page for fun!!)
    Thanks
    JB

  • How to create a dynamic RTF report which creates dynamic columns based on dynamic column selection from a table?

    Hi All,
    Suppose I have table, whose structure changes frequently on daily basis.
    For eg. desc my_table gives you following column name on Day 1
    SQL > desc my_table;
    Output
    Name
    Age
    Phone
    On Day 2, two more columns are added, viz, Address and Salary.
    SQL > desc my_table;
    Output
    Name
    Age
    Phone
    Address
    Salary
    Now I want to create an Dynnamic RTF report which would fetch data from ALL columns from my_table on daily basis. For that I have defined a concurrent program with XML as output type and have attached a data template/data definition to it which takes in XML as input and gives final output of conc program in EXCEL layout. I am able to do this for constant number of columns, but dont know how to do it when the number of columns to be displayed changes dynamically.
    For Day 1 my XML file should be like this.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    SELECT Name
    ,Age
    ,Phone
    FROM my_table
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_my_table" source="Q2">
      <element name="Name" value="Name" />
      <element name="Age" value="Age" />
      <element name="Phone" value="Phone" />
    </group>
    </dataStructure>
    </dataTemplate>
    And my Day 1, EXCEL output from RTF template should be like this.
    Name     Age     Phone
    Swapnill     23     12345
    For Day 2 my XML file should be like this. With 2 new columns selected in SELECT clause.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    SELECT Name
    ,Age
    ,Phone
    ,Address
    ,Salary
    FROM my_table
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_my_table" source="Q2">
      <element name="Name" value="Name" />
      <element name="Age" value="Age" />
      <element name="Phone" value="Phone" />
      <element name="Address" value="Address" />
      <element name="Salary" value="Salary" />
    </group>
    </dataStructure>
    </dataTemplate>
    And my Day 2, EXCEL output from RTF template should be like this.
    Name     Age     Phone     Address     Salary
    Swapnill     23     12345         Madrid     100000
    Now, I dont know below things.
    Make the XML dynamic as in on Day 1 there must be 3 columns in the SELECT statement and on Day 2, 5 columns. I want to create one dynamic XML which should not be required to be changed if new columns are added in my_table. I dont know how to create this query and also create their corresponding elements below.
    Make the RTF template dyanamic as in Day1 there must 3 columns in EXCEL output and on Day 2, 5 columns. I want to create a Dynamic RTF template which would show all the columns selected in Dynamic XML.I dont know how the RTF will create new XML tags and how it will know where to place it in the report. Means, I can create RTF template on Day 1, by loading XML data for 3 columns and placing 3 XML tags in template. But how will it create and place tags for new columns on Day 2?
    Hope, you got my requirement, its a challenging one. Please let me know how I can implement the required solution using RTF dynamically without any manual intervention.
    Regards,
    Swapnil K.
    Message was edited by: SwapnilK

    Hi All,
    I am able to fulfil above requirement. Now I am stuck at below point. Need your help!
    Is there any way to UPDATE the XML file attached to a Data Definition (XML Publisher > Data Definition) using a standard package or procedure call or may be an API from backend? I am creating an XML dynamically and I want to attach it to its Data Definition programmatically using SQL.
    Please let me know if there is any oracle functionality to do this.
    If not, please let me know the standard directories on application/database server where the XML files attached to Data Definitions are stored.
    For eg, /$APPL_TOP/ar/1.0/sql or something.
    Regards,
    Swapnil K.

  • Dynamic column selection

    I want to select specific columns from a table dynamically which are basically the columns returned by quering the user_tab_columns data dictionary which in turn has to satisfy certain condition for me.
    So, what I want to do is something like:
    SELECT b.(dynamic column list from a)
    FROM b,
    (SELECT column_name FROM user_tab_columns WHERE table_name='STH' AND ........) a
    any help will be greatly appreciated.

    sql>create or replace procedure p_dynamic_sql
      2  is
      3    v_sql varchar2(4000);
      4  begin
      5    v_sql := 'select ';
      6    for r in (select column_name
      7                from user_tab_cols
      8               where table_name = 'EMP'
      9                 and column_name like 'E%') loop
    10      v_sql := v_sql || r.column_name || ',';
    11    end loop;
    12    v_sql := rtrim(v_sql, ',') || ' from emp';
    13    dbms_output.put_line( v_sql );
    14    -- do something with SQL (open cursor, etc.)   
    15  end;
    16  /
    Procedure created.
    sql>exec p_dynamic_sql
    select EMPNO,ENAME from emp
    PL/SQL procedure successfully completed.

  • Dynamic column output based on selection.

    Hi all,
    I have certain qualification select-options upon the selection-screen.
    I have 5001 to 5012 range of qualificaitons.
    If user select only 5001 to 5003....
    I want only 3 columns ...or else if user wants to select 5008 to 5012  output should be have columns 5008 , 09,10,11...
    I am displaying output in
    mail format only
    concanate 'COL1' COL2' 'COL2' TO STRING SEPERATED BY C=>LB.
    loop at itab.
    CONCATE ITAB-1 itab-2 itab-3 to Xstring.
    endloop.
    Thanks and regards
    sas
    Edited by: saslove sap on Jul 7, 2010 5:36 AM

    Well I have harcoded the value  as below.I have no choice find .  Instead of using mutiple 'IF' conditions ANY other options are left:
      CONCATENATE
      'Personnel Number'    'Employee GUID'   'Last Name'   'First Name'   'Position Number'   'Position Title'   'Department Number'
      'Department Name'    'Employee Subgroup text'    'Employee Group text'   'SBU Head Personnel Number'   'SBU Head GUID'
      'SBU Head Name'   'Supervisor Personnel Number'   'Supervisor GUID'   'Supervisor Name'
      'Personnel Subarea text'
    'CF1-Director function'
    'CF2-Nonexecutive director function'
    'CF3-Chief Executive function'
    'CF8-Apportionment & oversight function'
    'CF10-Compliance oversight function'
    'CF11-Money laundering reporting function'
    'CF28-Systems & controls function'
    'CF29-Significant management function'
    'CF30-Customer function, Investment Advice'
    'CF30-Customer function, Investment Mgmt'
    'CF30-Customer function, Trading'
    'Admin - FSA T&C qualifying role'
        INTO S_OUTPUT-X SEPARATED BY C_TAB.
    IF C = 'X'.
    IF '50000001' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF1-Director function'  INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000002' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF2-Nonexecutive director function' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000003' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF3-Chief Executive function' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000004' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF8-Apportionment & oversight function' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000005' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF10-Compliance oversight function' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000006' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF11-Money laundering reporting function' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000007' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF28-Systems & controls function' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000008' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF29-Significant management function' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000009' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF30-Customer function, Investment Advice' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000010' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF30-Customer function, Investment Mgmt' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000011' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'CF30-Customer function, Trading' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000012' IN s_quali[].
       CONCATENATE S_OUTPUT-X    'Admin - FSA T&C qualifying role' INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    endif.
      APPEND S_OUTPUT.
      LOOP AT GIT_ITAB ASSIGNING <GFS_ITAB>.
        CLEAR S_OUTPUT.
        CONCATENATE
    <GFS_ITAB>-PERNR <GFS_ITAB>-EMPGUID <GFS_ITAB>-LNAME  <GFS_ITAB>-FNAME  <GFS_ITAB>-POSITION  <GFS_ITAB>-POSTITLE <GFS_ITAB>-DEPTNO <GFS_ITAB>-DEPTNAME  <GFS_ITAB>-EMPSUBTEXT <GFS_ITAB>-EMPGRPTEXT
    <GFS_ITAB>-SBUNO <GFS_ITAB>-SBUGUID <GFS_ITAB>-SBUNAME <GFS_ITAB>-SUPVNO <GFS_ITAB>-SUPVGUID <GFS_ITAB>-SUPVNAME <GFS_ITAB>-PSUBAREATEXT
       INTO S_OUTPUT-X SEPARATED BY C_TAB.
    IF C = 'X'.
    IF '50000001' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF1  INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000002' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF2 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000003' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF3 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000004' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF4 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000005' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF5 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000006' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF6 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000007' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF7 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000008' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF8 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000009' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF9 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000010' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF10 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000011' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF11 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    IF '50000012' IN s_quali[].
       CONCATENATE S_OUTPUT-X    <GFS_ITAB>-CF12 INTO S_OUTPUT-X SEPARATED BY C_TAB.
    endIF.
    endif.
      <GFS_ITAB>-CF2  <GFS_ITAB>-CF3 <GFS_ITAB>-CF4   <GFS_ITAB>-CF5 <GFS_ITAB>-CF6
    <GFS_ITAB>-CF7  <GFS_ITAB>-CF8 <GFS_ITAB>-CF9 <GFS_ITAB>-CF10  <GFS_ITAB>-CF11  <GFS_ITAB>-CF12
    *concatenate s_output-x c_cr into s_output-x.
        APPEND S_OUTPUT.
      ENDLOOP.

  • Dynamic column selection while running report

    Can any one explain how to get the following functionality in report:
    I have a cube with following fields:(with depriciaated amounts)
    Plant  Mat#  Fiscper       Jan   Feb  March April  May   June   July   Aug   Sep   Oct   Nov   Dec
    ==== ====    =====      ==== ==== ===== ==== ==== ===== ==== ==== ===== ==== ==== ====
    P1      M1     03/2009    $100    $90   $80   
    P1      M1     04/2009    $100    $90   $80     $70  
    P2      M2     04/2009     $10     $9      $8     
    P2      M2     04/2009     $10     $9      $8      $7
    When I run the report with Fiscper as selection, ie 04/2009, I shoud get the report displayed only April column
    Report out put: (Only April column should be displayed)
    Plant  Mat#  Fiscper       April
    ==== ====    =====       ====
    P1      M1     04/2009    $70      
    P2      M2     04/2009     $7
    When I run the report with Fiscper as selection, ie 03/2009, I shoud get the report displayed only March column
    Report out put: (Only March column should be displayed)
    Plant  Mat#  Fiscper       March
    ==== ====    =====       ====
    P1      M1     04/2009    $80      
    P2      M2     04/2009     $8
    Can any explain how to desing this in query designer?
    Thanks,
    PV

    create new selection
    drag and drop the kf
    drag and drop calmonth
    create formula variable for calmonth using type as "customer exit"
    now based on the fiscperiod you can fill calmonth in customer exit which will give you desired output
    you can use text variable if you want the heading for the KF to be dynamic.

  • BIEE & BI Publisher parameter & dynamic column selection

    Hi Gurus!
    I want to create a SQL Query on the BIServer from BIPublisher that create a data set that dynamically return a different column based on a BI Publisher parameter (that i will feed from a Dashboard prompt);
    I've tried to write something like the follow query, but always it returns errors...
    select case when :Parameter='Measure1' then mytable.measure1 else mytable.measure2 end as Measure, mytable.dim1 as Dim from mytable where mytable.year=:YearParam;
    the parameter in the where works, but I'm not able to use the parameter in the case clause.
    Is it possible to use the parameter in the case statement?
    If i write a similar sql against a RDBMS it works great..
    I'n on a 10.1.3.4.1
    Any suggestion?
    Regards,
    Daniele

    You might use the indexcol function for this purpose.
    http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_SQL15.html
    In the document, you have a hierarchy example.
    Success
    Nico

  • Dynamic Column Formula based on Prompt

    Hi,
    i've defined a prompt and a presentation variable associated called "Scenario". It can assume values "Actual" or "Budget"
    My Subject Area contains vary dimensions and a fact table called "Productivity Measures" with following fields: "Productivity Actual" - "Productivity Budget"
    I've created a report with an only field (Header: 'Productivity") which retrieves data from my "Productivity Measures" fact table.
    Now i want that if Scenario value is Actual, the column formula of my field is "Productivity Measures"."Productivity Actual", otherwhise if Scenario value is Budget, the column formula of my field change dinamically to "Productivity Measures"."Productivity Budget". Is it possible? How can i do?

    Hi user,
    Why cant you write a case statement on the column defined i.e. when you select actual you get what you want and viceversa
    eg:- CASE '@{scenario}'
    WHEN 'Actual' THEN 'Productivity Actual'
    WHEN 'Budget' THEN 'Productivity Budget'
    ELSE 'Productivity Actual'
    END
    In case of prompt_column you declared variable right,you can call it there or directly use column name.
    Hope it helps you with this.
    By,
    KK
    Edited by: Kranthi on Dec 16, 2010 11:21 PM

  • Dynamic Row Suppression based on grid POV

    Hi,
    I need to suppress rows based on the grid POV. The report is set up to have accounts in the rows and the user is able to select a specific account in the grid POV. Based on the grid selection, half of the accounts in the rows either need to be suppressed or not.
    One solution already available is to use advanced suppression on each row but this option will take too long. I'd like to find a solution using UDA's or some other way. Any ideas?

    Im not sure there is any simple way to get dynamic row selection based on what is selected in the page.
    If I were designing the form based on what you have stated, I would probably stick both Account and Year in the page, and the 400 products in rows. This would require the user to select the different combinations of Year / Account, but would mean only 12 columns (instead of 72).
    Alternatively you could stick Account in rows too - meaning 800 rows, but less combinations to select in Page....all depends what is deemed acceptable to the user.
    Probably other approaches that may be better than above (put Product in the Page for fun!!)
    Thanks
    JB

  • Creating a Dynamic Update Statement based on Select

    hi,
    i'm trying to create a dynamic update statement based on select statement
    my requirment is to query a joint tables and get the results then based on the results i need to copy all the data and create an update statement for each row
    for ex
    the update statement should look like this
    update iadvyy set SO_SWEEP_CNT = '1' where inst_no = '003' and memb_cust_no = 'aaaaaaaaaaaaaaaa';
    and the select statement like the following
    select substr(key_1,11,9) account_no,sord_mast SO_SWEEP_CNT from
    select acct_no,count(*) sord_mast from
    (select from_acct_no acct_no,update_mast
    from sord where FROM_SYS in ('DEP','INV') and TERM_DATE > 40460
    union all
    select to_acct_no acct_no,update_mast
    from sord where TO_SYS in ('DEP','INV') and TERM_DATE > 40460)
    group by Acct_no)
    right outer join
    invm
    on
    key_1 = '003'||acct_no
    where sord_mast > 0;
    so taking the above two columns from the above select statement and substitue the values as separate update statement.
    is that doable , please share your knowledge with me if poosible
    thanks in advanced

    is that doable , please share your knowledge with me if poosibleyes
    The standard advice when (ab)using EXECUTE IMMEDIATE is to compose the SQL statement in a single VARCHAR2 variable
    Then print the SQL before passing it to EXECUTE IMMEDIATE.
    COPY the statement & PASTE into sqlplus to validate its correctness.

  • Cannot use alias for dynamic column name in SELECT statement

    Hi,
    I want to retrieve values from several tables by using dynamic column & table name as below:
    DATA: tbl_name(30) TYPE c VALUE '/bic/tbi_srcsys',  " staticly initialized for this example
               col_name(30) TYPE c VALUE '/bic/bi_srcsys'.  " staticly initialized for this example
    SELECT (col_name) INTO CORRESPONDING FIELDS OF TABLE it_values FROM (tbl_name).
    The internal table "it_values" does not contain a field named "/bic/bi_srcsys", instead it has another generic field "value" so that the above code can be applied to other tables. I tried to use alias (AS) as below:
    SELECT (col_name) AS value INTO CORRESPONDING FIELDS OF TABLE it_values FROM (tbl_name).
    But this cannot work. I know that there are other ways to solve this problem, such as by using a single field in SELECT .. ENDSELECT and subsequently appending it to the work area and internal table as below:
    SELECT (col_name)  INTO (lv_value) FROM (tbl_name).
      wa_value-value = lv_value.
      APPEND wa_value TO it_values.
    ENDSELECT.
    Just wonder if there is any other more elegant workaround, because I might have several other fields instead of only one?
    Thanks.
    Regards,
    Joon Meng

    Hi Suhas,
    thanks for the quick reply.
    Sorry that I have not well described the structure of the internal table "it_values". This internal table contains several other fields (key, type, value, etc.).
    I guess that the following code
    SELECT (col_name) INTO TABLE it_values FROM (tbl_name).
    works if the internal table only has one field (value) or the field "value" is in the first position, right?
    In this case, I need to fill the "value" field of internal table it_values (ignore the other fields like type, key) with values retrieved from (col_name) of the DDIC table.
    Looking forward to your reply.
    BR,
    Joon Meng

  • How to dynamic select based on runtime value ?

    how to dynamic select based on runtime value ?
    I want to write a select function, which do selecting based on parameters. eg,
    CREATE OR REPLACE FUNCTION myfunction
    (tableName VARCHAR2, pkName VARCHAR2, pkValue VARCHAR2, requestString VARCHAR2)
    RETURN VARCHAR2 AS
    BEGIN
    select requestString from tableName where pkName=pkValue;
    RETURN NULL;
    END;
    myfunction('users', 'user_id', '100', 'user_name'); it will select 'user_name' from table 'users' where 'user_id' = '100'.
    This way could save lots of coding. but it can't pass compiler. how to work out ?
    Thanks.

    While this may save code, if used frequently it will be ineffecient as all [explicative deleted]. The danger is that it would be used even for repeatable statements.
    This mode of operation ensures that every statement [calling the funciton] needs to be reparsed, which is extremely expensive in Oracle (in CPU cycles, recursive SQL and shared pool memory).
    Such reparsing is rarely a good thing for the environment ... it could easily lead to buying more CPU (bigger box) and therefore adding more Oracle license ... which could quickly exceed the typical developer's salary.
    However - if you really, really want to do this, look up 'execute immendiate' in the PL/SQL manuals.

  • Dynamic Change Of Column Name based On The Dashboard Prompt in OBIEE 10g

    Hi All,
    I have a dashbord prompt called "calendar date". And, my report having some columns called "Product Name", "Code", "Yest Balance", "Today Balance". Now, while displaying the report in the dashboard, instead of "Today's Balance" they want to see the date which we have selected in the promt as a column name (each time we select a date in the promt, that would appear as a field name in stead of "Today's Balance" but values will be same (should show the balance for that date).
    Please advice.
    Thanks,
    BK.

    yeah...you are correct....these are workaround ...no out of box solution.
    Take the MAR11 target example in this current month is MAR 11 is populated by a session variable which gives you always current month.
    Second using union -combined query creating a header from one report and results from other report.
    But, coming to your req.......what ever the value selected in the calendar date that should come up in the column heading. so this is not possible with variable because for date of calendar image type you can not set a presentation variable. If not you can use a REQUEST VARIABLE.
    You can try 2nd way creating 2 reports one for header other for value.
    You can choose based on your flexibility. Instead you are showing the report along with prompt. I would suggest use appropriate name as 'selected date value'.

  • Table Sorting based on Column Selection

    Dear All,
    I am using an AbstractTableModel. I would like to implement the sorting based on Column selection. Could anyone help me in this please.
    Thanks in advance,
    Regards
    Irfaan

    check this
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.UIManager;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumnModel;
    import java.awt.Component;
    import java.awt.GridLayout;
    import java.awt.Insets;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.util.Hashtable;
    public class TableSorter extends JPanel
        private boolean             DEBUG       = false;
        private Object[]            columnNames = { "First Name", "Last Name", "Sport", "# of Years",
                                                    "Vegetarian"};
        private Object[][]          data        = { { "Mary", "Campione", "Snowboarding", 1, 2 },
                { "Alison", "Huml", "Rowing", 3, 4 }, { "Kathy", "Walrath", "Knitting", 5, 9 },
                { "Sharon", "Zakhour", "Speed reading", 6, 10 }, { "Philip", "Milne", "Pool", 7, 11 },
                { "Isaac", "Rabinovitch", "Nitpicking", 8, 12 }, };
        private SortFilterModel     m_modSortFilterModel;
        private TableColumnModel    m_modColumnModel;
        private TableHeaderRenderer m_btnSorterRenderer;
        protected boolean           m_bAbCOC    = true;
        JTable                      table       = new JTable();
        public TableSorter()
            super(new GridLayout(1, 0));
            m_modSortFilterModel = new SortFilterModel();
            m_modSortFilterModel.addMouseListener(table);
            table.setModel(m_modSortFilterModel);
            m_btnSorterRenderer = new TableHeaderRenderer();
            m_modColumnModel = table.getColumnModel();
            for (int i = 0; i < columnNames.length; i++)
                m_modColumnModel.getColumn(i).setHeaderRenderer(m_btnSorterRenderer);
            JScrollPane scrollPane = new JScrollPane(table);
            add(scrollPane);
        private class SortFilterModel extends AbstractTableModel
            int[]           indexes;
            ATSTableSorter  sorter;
            public String[] tableHeadersArray;
            boolean         isAscent = true;
            public void addMouseListener(final JTable table)
                table.getTableHeader().addMouseListener(new MouseAdapter()
                    public void mouseClicked(MouseEvent event)
                        int tableColumn = table.columnAtPoint(event.getPoint());
                        m_btnSorterRenderer.setPressedColumn(tableColumn);
                        m_btnSorterRenderer.setSelectedColumn(tableColumn);
                        if (TableHeaderRenderer.DOWN == m_btnSorterRenderer.getState(tableColumn))
                            isAscent = true;
                        else
                            isAscent = false;
                        // translate to table model index and sort
                        int modelColumn = table.convertColumnIndexToModel(tableColumn);
                        sortByColumn(modelColumn, isAscent);
            public Object getValueAt(int row, int col)
                int rowIndex = row;
                if (indexes != null)
                    rowIndex = indexes[row];
                return data[rowIndex][col];
            public void setValueAt(Object value, int row, int col)
                int rowIndex = row;
                if (indexes != null)
                    rowIndex = indexes[row];
                super.setValueAt(value, rowIndex, col);
            public void sortByColumn(int column, boolean isAscent)
                if (sorter == null)
                    sorter = new ATSTableSorter(this);
                sorter.sort(column, isAscent);
                fireTableDataChanged();
            public int[] getIndexes()
                int n = getRowCount();
                if (indexes != null)
                    if (indexes.length == n)
                        return indexes;
                indexes = new int[n];
                for (int i = 0; i < n; i++)
                    indexes[i] = i;
                return indexes;
            public int getRowCount()
                return data.length;
            public String getColumnName(int c)
                return columnNames[c].toString();
            public int getColumnCount()
                return columnNames.length;
            public Class getColumnClass(int col)
                switch (col)
                case 0:
                    return String.class;
                case 1:
                    return String.class;
                case 2:
                    return String.class;
                case 3:
                    return Integer.class;
                case 4:
                    return Integer.class;
                          default:
                    return Object.class;
        class ATSTableSorter
            SortFilterModel model;
            public ATSTableSorter(SortFilterModel model)
                this.model = model;
            public void sort(int column, boolean isAscent)
                int n = model.getRowCount();
                int[] indexes = model.getIndexes();
                for (int i = 0; i < n - 1; i++)
                    int k = i;
                    for (int j = i + 1; j < n; j++)
                        if (isAscent)
                            if (compare(column, j, k) < 0)
                                k = j;
                        else
                            if (compare(column, j, k) > 0)
                                k = j;
                    int tmp = indexes;
    indexes[i] = indexes[k];
    indexes[k] = tmp;
    public int compare(int column, int row1, int row2)
    Object o1 = model.getValueAt(row1, column);
    Object o2 = model.getValueAt(row2, column);
    if (o1 == null && o2 == null)
    return 0;
    else if (o1 == null)
    return -1;
    else if (o2 == null)
    return 1;
    else
    Class type = model.getColumnClass(column);
    if (type.getSuperclass() == Number.class)
    return compare((Number) o1, (Number) o2);
    else if (type == String.class)
    return ((String) o1).compareTo((String) o2);
    else
    return ((String) o1).compareTo((String) o2);
    public int compare(Number o1, Number o2)
    double n1 = o1.doubleValue();
    double n2 = o2.doubleValue();
    if (n1 < n2)
    return -1;
    else if (n1 > n2)
    return 1;
    else
    return 0;
    class TableHeaderRenderer extends JButton implements TableCellRenderer
    public static final int NONE = 0;
    public static final int DOWN = 1;
    public static final int UP = 2;
    int pushedColumn;
    Hashtable state;
    public TableHeaderRenderer()
    pushedColumn = -1;
    state = new Hashtable();
    setMargin(new Insets(0, 0, 0, 0));
    setHorizontalTextPosition(LEFT);
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column)
    setText((value == null) ? "" : value.toString());
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    boolean isPressed = (column == pushedColumn);
    getModel().setPressed(isPressed);
    getModel().setArmed(isPressed);
    return this;
    public void setPressedColumn(int col)
    pushedColumn = col;
    public void setSelectedColumn(int col)
    if (col < 0)
    return;
    Integer value = null;
    Object obj = state.get(new Integer(col));
    if (obj == null)
    value = new Integer(DOWN);
    else
    if (((Integer) obj).intValue() == DOWN)
    value = new Integer(UP);
    else
    value = new Integer(DOWN);
    state.clear();
    state.put(new Integer(col), value);
    public int getState(int col)
    int retValue;
    Object obj = state.get(new Integer(col));
    if (obj == null)
    retValue = NONE;
    else
    if (((Integer) obj).intValue() == DOWN)
    retValue = DOWN;
    else
    retValue = UP;
    return retValue;
    private static void createAndShowGUI()
    JFrame frame = new JFrame("TableDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    TableSorter newContentPane = new TableSorter();
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args)
    javax.swing.SwingUtilities.invokeLater(new Runnable()
    public void run()
    createAndShowGUI();

  • Policy-based Tunnel Selection and PBTS with Dynamic Tunnel Selection option

    Unfortunately I can't test this feature on GSR 12k platform.
    RP/0/0/CPU0:ios(config)#show config failed
    !! SEMANTIC ERRORS: This configuration was rejected by
    !! the system due to semantic errors. The individual
    !! errors with each failed configuration command can be
    !! found below.
    interface tunnel-te1
    policy-class 1
    !!% The requested operation is not supported: Feature not supported on this platform
    end
    What is the difference between Dynamic Tunnel Selection and ordinary PBTS? It would be nice to see some real-world example.

    PBTS with DTS is supported only on the Cisco XR 12000 Series Router... you should rather test it on 12K platform.

Maybe you are looking for

  • How do I find out a file's particular size?

    Good Evening, I am looking for assistance with figuring out a file's particular size within a group of files. If I have one large directory and I am looking to find out what the smallest file in that directory is, how would I go about doing it? Also,

  • How can i display the days of the month in my report, please help

    dear all my table name is day_close_table it contains these columns: product_code number, the_date date, sale_qty number, buy_qty number price number i need to make report like the fiollowing product : 10144 from: 1-jan-2006 to :10-jan-2006 days | 1

  • Question about crossdomain.xml

    I am having problems having my Flex app call some ColdFusion pages. I read this on the Adobe website. "Add a crossdomain.xml file to the server with the data." If my flex files and my .cfm files are on the same server (server A), but in the coldfusio

  • Itunes on WHS 2011? Help

    I am trying to get iTunes working on my server running windows home server 2011 I have so far installed the follwing iTunes 10, with lates tupdates installed 16/10/12 QuickTime ihomeserver I Have copied over my old library to the server and placed it

  • Cost planning from CJR2

    Hi friends, I am trying to plan cost through cost element by using CJR2 t-code. Can any one please tell me that if i plan cost through CJR2 does a posting document is generated? if yes then for that do i need to do any config setting? Thanks Satish.