Dynamically change number of columns in report

all,
I am trying to change the number of columns in a report dynamically as in this sample(http://actionet.homelinux.net/htmldb/f?p=LSPDEMO:60:11041263091189::NO:::) , can somebody who has this code kindly send it to me or make reference...i'll appreciate

But Howards solution is easier to follow and works perfectly with a shuttle.
Define a function like this:
create or replace FUNCTION item_in_list(p_num IN NUMBER, p_shuttle_name in VARCHAR2)
RETURN NUMBER
IS
    l_vc_arr2   APEX_APPLICATION_GLOBAL.VC_ARR2;
    TYPE number_list is TABLE OF NUMBER;
    num_list number_list := number_list();
    x_ret NUMBER;
BEGIN
    /* checks if p_num exists in the colon delimited list p_shuttle_name */
        l_vc_arr2 := APEX_UTIL.STRING_TO_TABLE(p_shuttle_name);
        FOR i IN 1..l_vc_arr2.COUNT LOOP
            num_list.EXTEND;
            num_list(i):= CAST(l_vc_arr2(i) AS NUMBER);
        END LOOP;
        IF p_num MEMBER OF num_list then
            return 1;
        else
            return 0;
        end if;
END;
And then for every column put a condition (Function returning boolean) like this:
begin
if item_in_list(1, : p10_shuttle) = 1 then
return true;
else
return false;
end if;
end;
where 1 in my case is the return lov value.
This is if your shuttle's return value is numeric and display value is varchar2. If both are varchar2 use instr as Howard suggested.
Its probably not as fancy as the Jquery one but gets the job done.

Similar Messages

  • 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                       

  • Dynamically changing the layout of thre report-urgent please

    Can we change the layout of the report dynamically during runtime for example:the user should have flexibility to change the width, size , position of columns before the report is displayed & also he choose some fields not to display as per his discretion.
    Mahesh

    There are several ways of doing this, it really depends on your requirements as to which is suitable. (There are probably other ways of doing this as well).
    - Try Reports XML Customizations
    This is available in 6i and allows you to create a report dynamically on the fly. The template used will also allow you to change the paper size as well. The main limitation is that you are relying only on Reports defaulting to create the layout for you. The advantage is that you can store all your information to create the report in meta-data which can be driven by another tool.
    - Use lexical parameters for queries and format triggers
    Here, you have a fixed layout but dynamically change the query columns to the correct order. You would normally standardise on a "character" column type in order to do this. Even though the layout is fixed, you can use variable sized fields to push objects around. This can be difficult to setup.
    - Use several layouts
    You're reducing the options for the user, but you can have several layouts in the same report and turn them on/off. Effectively creating differing views of the same data.

  • Is it posible a query that builds dynamically the number of columns?

    Hi experts!
    I have a query that shows amounts in 12 columns corresponding on the calendar months of the year.   Now,  I need to change that getting in a previous screen how many months the user wants to see.   The query has to build dynamically the number of columns to show.    Can I do that with query designer?  How?
    I am working in V7.0.
    I appreciate your help.
    Thanks!
    Ada.

    Hi experts!
    I have a query that shows amounts in 12 columns corresponding on the calendar months of the year.   Now,  I need to change that getting in a previous screen how many months the user wants to see.   The query has to build dynamically the number of columns to show.    Can I do that with query designer?  How?
    I am working in V7.0.
    I appreciate your help.
    Thanks!
    Ada.

  • How can I dynamically change group field column?

    Hello!
    I need to group data and create group totals for that table. Is
    it possible to dynamically change group field column for
    specific table, depending on data retreived from parameter form?
    Thanks,
    Mario.

    quote:
    Originally posted by:
    ljonny18
    Hi,
    I am using a grid within a component in my Flex application.
    I have an XML dataProvider, and I want to change the row
    colour of my Grid depending on a value coming form my dataProvider
    – but I cant seem to get this to work :(
    can anyone help / advise me on how I can dynamically change the
    colour of my grid row depending on a value coming from my XML
    DataProvider????
    Thanks,
    Jon.
    Hi,
    a few hours ago I stumbled across this cookbook entry - it
    didn't solve MY problem, but maybe it provides a way to solve your
    problem?
    http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId=61&product Id=2&loc=en_US
    From the article:
    quote:
    Changing the background color of a DataGrid cell is not as
    simple as changing some style because the default renderer for a
    DataGrid cell does not have a backgroundColor. Therefore, to do
    this simple task, you have to create a custom itemRenderer where
    you draw your own background in the updateDisplayList function.
    HTH
    Uwe

  • How to change number format in web reports

    Hi, Experts,
        Simple question, if I want to change the number format on web report as following
    . . . . . . . . Actual
    . . . . . . . . *1000SGD 
      new order   .   341.5
      sales       .   567.45
    if I click "Actual" then select properties, set data format from "in 1000" & "0" to "in 1" & "0.00", nothing changed in web report after refresh.
    if i click one number (for example: 341.5) or "New order" to set data format from "in 1000" & "0" to "in 1" & "0.00", only this row's format is changed, others row still keep old format.
    how to change whole column's data format at once setting?
    thanks in advance.
    Message was edited by: jie miao
    Message was edited by: jie miao

    Hi,
    Logout and login may help you and also Delete the session in SM04  before re login. Some times system will not do complete refresh of data even though you select refresh button.
    With rgds,
    Anil Kumar Sharma .P

  • Dynamic change of headings in SQL Report

    Can you dynamically change a reports Column Heading Text. I want a selected value from the database to become 1 of the column headings.

    If you are ready to take bit of trouble and modify the generated package body. you can try the following.
    1. go to the procedure show_internal in the generated package body.
    2. you will see PORTAL30.wwv_user_utilities.add_other_arguments(
    3. 'p_other_args' parameter has "_col_headings" as one of the values.
    4. the corresponding 'p_other_vals' values will show up in the report column heading. [ an example is PORTAL30.wwv_user_lang.lang('Empno') ]
    So if you can pass your 'dynamic' heading values here, you can change the report heading dynamically.

  • How to clone data with in Table with dynamic 'n' number of columns

    Hi All,
    I've a table with syntax,
    create table Temp (id number primary key, name varchar2(10), partner varchar2(10), info varchar2(20));
    And with data like
    insert itno temp values (sequence.nextval, 'test', 'p1', 'info for p1');
    insert into temp values (sequence.nextval, 'test', 'p2', 'info for p2');
    And now, i need to clone the data in TEMP table of name 'test' for new name 'test1' and here is my script,
    insert into Temp  select sequence.nextval id, 'test1' name, partner, info from TEMP where name='test1';
    this query executed successfully and able to insert records.
    The PROBLEM is,
    if some new columns added in TEMP table, need to update this query.
    How to clone the data with in the table for *'n' number of columns and*
    some columns with dynamic data and remaining columns as source data.
    Thanks & Regards
    PavanPinnu.
    Edited by: pavankumargupta on Apr 30, 2009 10:37 AM

    Hi,
    Thanks for the quick reply.
    My Scenario, is we have a Game Details table. When ever some Game get cloned, we need to add new records in to that Table for the new Game.
    As, the id will be primary key, this should populate from a Sequence (in our system, we used this) and Game Name will be new Game Name. And data for other columns should be same as Parent Game.
    when ever business needs changes, there will be some addition of new columns in Table.
    And with the existing query,
    insert into Temp (id, name, partner, info) select sequence.nextval id, 'test1' name, partner, info from TEMP where name='test'_
    will successfully add new rows but new added columns will have empty data.
    so, is there any way to do this, i mean, some columns with sequence values and other columns with existing values.
    One way, we can do is, get ResultSet MetaData (i'm using Java), and parse the columns. prepare a query in required format.
    I'm looking for alternative ways in query format in SQL.
    Thanks & Regards
    PavanPinnu.
    Edited by: pavankumargupta on Apr 30, 2009 11:05 AM
    Edited by: pavankumargupta on Apr 30, 2009 11:05 AM

  • Changing number of columns on master page, does not affect pages?

    I create a master page. say three columns per spread.
    I go to actual pages, flow my type in with the loaded cursor and holding the shift key... it works like a charm... text flows in the three colums, adding pages until the end of the manuscript...
    Now I decide I don't like the three columns. I go to the master page and change to 4 columns via "margins and columns..." under LAYOUT menu
    I go to the pages assuming that any change in a masterpage will translate to the pages... NOT!
    If I go to to my first page, the type is still in three colums...
    All other changes I make on the masterpage do translate to the pages... like say a color bar at the top, the size and font of the folios... BUT NOT if I change the number of columns???
    Can anyone shed light on this?

    You MUST tick the Option for "Master Text Frame" when Creating a new document.
    OR you MUST include a Text Frame with the number of Columns on the master page.
    Copy the text to the clip board
    Delete all page except page 1
    remove the existing text frame.
    Drag the Master A to the page 1
    CTRL or CMD (MAC) click shift the text frame to break it from the master.
    Now paste your text in here
    Insert a new page
    And click the Overload (red cross) button and connect it to the page 2 hodling down shift.
    From memory - hope I got it right !

  • Dynamically Changing Number of Channels in Chart

    Hi,
    I have a simple question about a labview programming issue. I am
    trying to modify an NI Example program for demonstrational purposes.
    I am using the Multi-plot real-time chart example program (link below)
    from the NI website. I have changed your example for the chart to
    display the data in the stacked plot mode. How could I modify it to
    vary the number of traces dynamically. Is this possible? My goal
    would be to use a series or radio buttons to control viewing 4, 8 or
    16 channels, in real time. All of the code and programs I have seen
    have channel display statically in the begining setup. Is there a
    property node of the chart that controls this?
    Thanks
    John
    http://zone.ni.com/devzone/explprog.nsf/6c163603
    265406328625682a006ed37d/5ac3fd88cb3815f086256657007542ee?OpenDocument

    To accomplish your goal, the example VI needs to be modified a little bit. I've made one such modification and attached the modified file. I hope it helps. Please note that nothing shows on the Front Panel Until you press one of the control buttons.
    Attachments:
    Modified_Multi-plot_real-time_chart.vi ‏138 KB

  • Dynamically display drill-down column in report

    We have two drill-down hierarchies 1. Calendar Year and 2. Fiscal Year.
    In a report, we have year column along with some other measures. The year column must show the values based on user's choice - If the user is interested in fiscal then the year must show fiscal year else the year must show the calendar year values.
    We thought of the following approach
    1. Use a prompt - which displays Calendar/Fiscal.
    2. Store the user selected prompt value (Calendar/Fiscal) in a variable
    3. In the report, for the year column, use CASE logic on the variable to decide whether Calendar year or the Fiscal year must be shown.
    This works well but the drawback is - the year isn't drillable anymore.
    Any other alternatives to solve this ?
    Thanks in advance

    Are you showing the report on a dashboard or just in Answers? Do you want in-place drilling or can you jump to a new report?
    One option is to enable navigation on the year column data and set it to jump a new report - you will need to pass the cell values as arguments in the URL - but if you want to just use plain old drill down (within the same report) I think you will have to use two reports, one for fiscal and one for calendar. Here we can get a little creative and use guided analytics to choose which of the two reports to show on the dashboard based on the selection made.
    Pete Scott
    http://www.rittmanmead.com

  • [JS CS3] Changing number of columns

    Hi all,
    I don't suppose anyone has a script that will change single-frame textboxes (800 pages worth, which is why I am looking to script) to 2-column ones? I wrote a script a while back that allows a user to choose a template, choose a Word file, place (and autoflow) the text, etc. It worked fine until today, when I needed to run it on a 2-column template. Since I don't know much about scripting for single-column vs. multi-column, I figure I will run the original script, then call a script at the end that will change all of the text boxes from 1-column to 2. Anyone worked on something like this before?
    Thanks,
    Matt

    So I am aware that I can simply change the columns using Find/Change object, which I will use if I cannot figure how to script this (which I would prefer to do).
    I have attempted to modify my usual Find/Change script; using the DOM, I figured that "textColummCount" would be exactly what I am looking for. However, the following does not seem to work:
    app.findObjectPreferences.textColumnCount = 1;
    app.changeObjectPreferences.textColumnCount = 2;
    app.documents.item(0).changeObject();
    Seemed easy enough in theory, but when I run this and open the Find Object GUI, it is blank, which means that I am not communicating with INDD. Any ideas?
    Matt

  • Dynamic setting number of rows in report region

    How to implement that each user can define how much initial records should be returned in report region?
    THX!

    Solved reading How to:
    http://www.oracle.com/technology/products/database/htmldb/howtos/howto_report_rownum.html
    Maybe it was not so obvious to someone else also!
    ;-)

  • Dynamically change region sequence/column

    I have a page that has many regions on it (ie. dashboard). The regions are all set to customize so the user can hide/show any of them. I have them all set with Display Point Page Template Body (3) and in columns 1-3 (see below):
    Region 1 Region 2 Region 3
    Region 4 Region 5 Region 6
    My problem is that the users want to be able to decide what sequence/column to display each region. .ie move Region5 under the 1st column or move it above Region 2. Is there any way to do that? Should I be using a different approach for dashboarding?
    Thanks

    Hi Bob,
    it should be possible with Javascript. Each region is contained in a HTML-table cell. With the region static-id you can identify each region with something like :
    theRegion = document.getElementById('region static-id')
    the HTML-content of the region would be.
    theRegion.innerHTML
    You should be able to exchange the content of the regions like this.
    DickDral

  • List Box View - Change Number of Columns

    I'm using Box View to display a couple of list columns (Logo, Org Name). This gives me a very nice "dashboard" view of the list which I can drill into using the Org Name link. I've already figured out how to resize the webpart in SPD to get a tiled
    look.
    The Problem: I'd like to display 4-5 columns not just the 2 that Box View supports OOB
    Solution ???

    ISJ - I created a new view on an existing SharePoint list that had Logo and Organization fields already. New "Logo View" shows only those 2 columns. I selected Box View No Labels as the Style - giving
    me the "tiled" look I need
    Unable to upload screenshot - getting message re: until Microsoft can verify my account
    The view is simple - As "illustrated" below
    LOGO
    Org Name (link)
    I'd like to get 3 more columns across horizontally
    Thanks so much in advance for your reply :)

Maybe you are looking for

  • How can I put one "shape" on top of another in pages?

    Hi all: I'm trying to do something pretty simple.  I made some shapes using the "shapes" tool in the toolbar.  I want to put one shape on top of (or in front of) another but it gives me the masking tool instead.  I tried putting a shap in the backgro

  • Difference B1i included in SAP2007A - SAP B1iSN 2007A

    Short question: When I install SAP2007A the module B1i is installed with SAP B1. What is the difference between this B1i module and the separate software B1iSN 2007A ? In a workshop some time ago (where I was not well enough prepared to ask senseful

  • How to pass a single character to dll (as a parameter)

    How do pass a single character to dll (as a parameter). This is a third party dll that i am unable to change. e.g.: int functionName(char* process, char myChar);

  • Broken DC after re-importing model

    Hello, I have an existing model with an RFC already present in the model. A few changes have been made to the structure of the RFC which required a re-import of the model. After re-import, the DC becomes Broken on NWDS and also all the structures and

  • Document changes don't save

    I have an older iMac, OS 10.2.8. I will soon get a new laptop, but in the meantime, I'm having trouble in that it intermittently does not save my changes. I have given the save command, and it closes without asking if I want to save changes, but when