Dynamic number of columns in the table

Hello

I use JDev 10.1.3.3.0 with ADF. I just want to create a table, with a dynamic number of columns in the table. The background is that a user of my webapplication can create and submit a sql query. Now, I have to show him the results. My idea was, I have save the result in a bean managed (ResultTable), which is stored in the session context and map at my table in my page.

If I search the Forum and don't get only one useful thread: {: identifier of the thread = 971888}, but I don't exactly understand. What is the CollectionModel? Do I need this?

I'm trying to report on the following:

ResultTable
public class ResultTable {

    public static final String SESSION_NAME = "ResultTable";
    private ArrayList<ResultColumn> columnList; 
    private CollectionModel collectionModel;

    public ResultTable() {
    }

    public ArrayList<ResultColumn> getColumnList() {
        return columnList;
    }

    public void setColumnList(ArrayList<ResultColumn> columnList) {
        this.columnList = columnList;
    }
}
ResultColumn
public class ResultColumn {
    
    private ArrayList<ResultRow> rowList;
    private String name;

    public ResultColumn() {
    }

    public ArrayList<ResultRow> getRowList() {
        return rowList;
    }

    public void setRowList(ArrayList<ResultRow> rowList) {
        this.rowList = rowList;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
ResultTable
public class ResultRow {
    
    private String value;

    public ResultRow() {
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
My showResult.jspx
<af:table emptyText="No items were found"
          value="ResultTable.columnList"
          var="column"
          varStatus="colStatus"
          id="table1">
  <af:forEach items="#{column.rowList}" var="row" varStatus="rowStatus">
    <af:column sortable="false" headerText="#{column.name}" 
               id="column#{colStatus.index}">
      <af:outputText value="#{row.value}"
                     id="outputText#{rowStatus.index}"/>
    </af:column>
  </af:forEach>
</af:table>
The ResultTable was filled with data, but the Board is not filled. So, I think, it must be rejected to the data binding.

I get warnings and errors to run too. But I don't know if they are the result or cause of my problem.
27.10.2009 10:15:41 oracle.adfinternal.view.faces.renderkit.core.xhtml.TableRenderer renderTableWithoutColumns
WARNUNG: Table with id: form1:table1 has no visible columns!
27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
SCHWERWIEGEND: Element End name:span does not match start name:div
27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
SCHWERWIEGEND: Element End name:span does not match start name:div
27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
SCHWERWIEGEND: Element End name:form does not match start name:span
27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
SCHWERWIEGEND: Element End name:body does not match start name:form
27.10.2009 10:15:41 oracle.adfinternal.view.faces.io.HtmlResponseWriter endElement
SCHWERWIEGEND: Element End name:html does not match start name:body
Concerning

Majo

Hi Mario,.


  
    
      
    
  

Note that your JSPX snippet above has serious shortcomings:

  • 'ResultTable.rowList' is not an EL expression, but the value attribute of the af: table must refer to an EL expression
  • Items AF:foreach = "#{row.cellList}"-you don't have to store information about the columns of all rows, more it won't work as af:forEach tag may not see the value of the expression of EL #{line} (or any component EL expression created). " See the tagdoc here: http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/forEach.html
  • "ID =" Column #{cellStatus.index} "and id =" outputText #{rowStatus.index} "are invalid and that they don't compile even as id attributes cannot contain EL expressions.

    .

    I think to solve your problem, you need three things:

  • List of columns (for example the list If you need to store only the names of column or list If you need additional information),.
  • list of lines,
  • a line can be a map (with the name of the column - cell data mapping; card e.g.) or a list (with columns indexed; for examplelist).

    Example with the lines of the map:

    JSPX snippet:

    
      
        
          
        
      
    
    

    The ResultTable bean:

    public class ResultTable {
    
        private List columnList;
        private List> rowList; 
    
        public ResultTable() {
        }
    
        public List getColumnList() {
            return columnList;
        }
    
        public void setColumnList(List columnList) {
            this.columnList = columnList;
        }
    
        public List> getRowList() {
            return rowList;
        }
    
        public void setColumnList(List> rowList) {
            this.rowList= rowList;
        }
    
    }
    

    Type ResultColumn:

    public class ResultColumn {
    
        // additional fields if needed...
        private String name;
    
        public ResultColumn() {
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    }
    

    AF:table display correctly after the initialization of the values in your beans properly filled ResultTalbe (e.g. to fill the list of rank with the lines).

    Hope this helps,
    Patrik

  • Tags: Java

    Similar Questions

    • How to check the index, on the number of columns in the table is created

      How to check on the number of columns in the table the index has been created. ??

      OR

      How check index, on the number of columns in the table that it is been created?

      890306 wrote:
      How to check on the number of columns in the table the index has been created. ??

      >

      OR

      How check index, on the number of columns in the table that it is been created?

      query USER_IND_COLUMNS

      SQL> desc user_ind_columns
       Name                            Null?    Type
       ----------------------------------------- -------- ----------------------------
       INDEX_NAME                             VARCHAR2(30)
       TABLE_NAME                             VARCHAR2(30)
       COLUMN_NAME                             VARCHAR2(4000)
       COLUMN_POSITION                        NUMBER
       COLUMN_LENGTH                             NUMBER
       CHAR_LENGTH                             NUMBER
       DESCEND                             VARCHAR2(4)
      

      Handle: 890306
      Status level: Beginner
      Join date: October 8, 2011
      Messages total: 13
      Total Questions: 5 (5 open)

      Why all the question still pending?

      Published by: sb92075 on December 3, 2011 17:21

    • ADF 11g - adding serial No. sum of column/calculation of column in the table of the ADF.

      Hello

      -How can I add serial number of column in the table of the ADF.
      -What is the way to calculate the sum of a column at the end of the table. (Table of the ADF). That is to say.
      10
      20
      15
      ______
      45


      Niaz M

      Hello

      Here you have some links to blog posts how do the sum:
      http://apps.branislavnemec.com/blogs/faces/bjanko/blogs.jsp?blog=bjanko20070725180020
      http://Kuba.zilp.pl/?id=781

      Kind regards

      Branislav

      Published by: Branislav Nemec June 6, 2011 11:23

    • How to export data to excel that has 2 tables with the same number of columns and the column names?

      Hi everyone, yet once landed upward with a problem.

      After trying many things to myself, finally decided to post here...

      I created a form in form builder 6i in which clicking on a button, the data gets exported to the excel sheet.

      It works very well with a single table. The problem now is that I cannot do the same with 2 tables.

      Because the tables have the same number of columns and the columns names.

      Here are the 2 tables with column names:

      Table-1 (MONTHLY_PART_1) Table-2 (MONTHLY_PART_2)
      SL_NOSL_NO
      MODELMODEL
      END_DATEEND_DATE
      U-1U-1
      U-2U-2
      U-4U-4
      ..................
      ..................
      U-20U-20
      U-25U-25

      Given that the tables have the same column names, I get the following error :

      402 error at line 103, column 4

      required aliases in the SELECT list of the slider to avoid duplicate column names.

      So how to export data to excel that has 2 tables with the same number of columns and the column names?

      Should I paste the code? Should I publish this query in 'SQL and PL/SQL ' Forum?

      Help me with this please.

      Thank you.

      Wait a second... is this a kind of House of partitioning? Shouldn't it is a union of two tables instead a join?

      see you soon

    • How to remove columns from the table on the master 1-0?

      I have an array of 96 columns with strings. I also have the array of int 96-elemets (mask) with 1 and 0.

      What I want to do is to is to remove (or hide - but I read that it is not possible) all the columns with index corresponding to 0 in the mask table.

      example:

      columns in the table

      1 2 3 4 5

      mask

      0 1 0 0 1

      I want to remove the columns 1, 3 and 4 and leave only 2 and 5 in my table.

      How can I do?

      If I create loop for with i as the index of the column, when I do DeleteTableColumns() columns number decreases, and I get an error of range out of

      Or do I have an option to hide the unnecessary columns (not set their width to 1, it's very ugly-looking)?

      Please help me (())

      Hello rovnyart!

      1. removal of columns in the table:

      I suspect that the reason why you get the out-of-range error is due to fact that in your loop, you delete the columns in the table, you'll eventually end up by referring to a column that no longer exists, because the other columns before it have been deleted. While you remove each column of your table in the loop for example, the column index number will move, because you deleted the other columns in front of her.

      To resolve this, even if you delete a column in your loop, make sure that you take also into account that the index of the column is moved because of the removed columns.

      2 hide columns in table:

      You can use the ATTR_COLUMN_VISIBLE attribute to hide columns in the table:

      http://forums.NI.com/T5/LabWindows-CVI-idea-exchange/add-attr-column-visible-attribute-for-table-Col...

      http://zone.NI.com/reference/en-XX/help/370051Y-01/CVI/uiref/cviattrcolumnvisible_column/

      3 alternatives:

      Note that another alternative would also use a tree instead, control as the tree control also supports the hidable columns:

      http://forums.NI.com/T5/LabWindows-CVI/table-hide-column/TD-p/569773

      Best regards!

      -Johannes

    • How do I get the number of characters in the table

      Hi all

      I'm writing a query.

      Requirement is like this.

      You will need to obtain the total number of a character in a table.

      Here is an example of data.

      There are table T1 that has Column1, Column2, and Column3.

      Column1Column2Column3
      #*
      *&$
      (**
      *%!

      This is I want to get the total number of characters "*" in the table, regardless of the number of columns in this table.

      By the sample data above, I should get the count as '5'.

      I want to translate is not necessary:

      WITH got_columns_123 AS

      (

      SELECT column1 | Column2 | Column3 AS columns_123

      FROM t1

      )

      SELECT NVL (SUM ((columns_123) - NVL LENGTH (LENGTH (REPLACE (columns_123, ' *')), 0)), 0)

      OF got_columns_123;

    • limiting number of column in the 4.1 apex data loader?

      Hi all!

      Is there a limit on the number of column in the APEX 4.1 data loading page?

      My DB object has 59 columns and they are all available in single colum drop of my load sample data table definition boxes.
      On page two of the wizard created database load pages "data/table mapping" columns only 45 is indicated. These columns are correctly inserted in my table. The last 14 columns are ignored.

      If anyone knows if there is a limitation and can it be extended?

      Thanks for any reply and cordially
      Kai

      No, I don't have a solution for this.

      Split the file within columns each, with the primary key that is repeated and then sting tables up to post upload could be easier than to use other roads.

      And then there's always the good old SQL Loader and external Tables. But the integration of these into the Apex is not easy because Apex runs on the server and the file is usually the disk of HARD local to the client.

      Kind regards

    • Unable to add a new column to the table of the LCD? Option, just usually add it.

      I have a form of LCD with a table in it. Im trying to simply add a new column to the table. The option is there, but the column appear just after clicking Add the column to the left. I selected a column, right click the space > insert > column to the left. But the habit intsert. The object table properties tab shows lines and colum numbers, but they are grey.

      See screenshots:

      http://www.emermed.NET/staging/forums...

      http://www.emermed.NET/staging/forums...

      It is a dynamic array, where a new line can be inserted using a button. Is that the dynamic nature of the question? ID hate to cancel all the flow dynamics and programming just to add a column, and then reapply them all.

      Thank you!

      Hello

      You do not add the columns in the object > palette (screenshot 2) of the Table. I suspect that the problem is that it is not enough on the page (in the content area) to add the column. In the screenshot 1, if you look at the width of the column highlighted from the space to the right of the table, you will see that a column can be added due to restrictions of space.

      Reduce the width of the column highlighted (temporarily), and then add a column. Once added, you can resize the columns to match the width of the page.

      Hope that helps,

      Niall

    • How to find the NULL columns in the table?

      Hello

      Please provide the query to search for null columns in the table. Here, all the rows in the table have same column as null. It will not change.

      Table
      ---------------
      C1 c2 c3 c4
      X C 10
      T D 20

      I want to know that C2 is the nullable column.
      Thanks in advance!

      Kind regards
      Florian...

      A variance more

      create or replace function is_nulled_column(tab varchar2, col varchar2) return varchar2 is
      cnt number:=1;
      begin
        execute immediate 'select count(1) from '||tab||' where '||col||' is not null and rownum=1' into cnt;
        return case when cnt=0 then 'Y' else 'N' end;
      end;
      

      and use:

      select
       c.OWNER,c.TABLE_NAME,c.COLUMN_NAME,c.NULLABLE,is_nulled_column(c.TABLE_NAME,c.COLUMN_NAME) all_nulls
      from all_tab_columns c
      where c.OWNER=user
      and c.TABLE_NAME like '%'
      order by c.OWNER,c.TABLE_NAME,c.COLUMN_ID
      
    • display / hide column of the table running

      Are there known issues with display / hide a column of the table at run time?

      I have a table that contains a column with a check box and another with a radio button.  If the user is allowed to select more than one row in the table (as indicated by a form variable), then I want to hide the column of radio and checkbox column.  If not, I want to show / hide the contrary.

      I show / hide the column header too.  When I preview the form, however, the data in the table appears "scoot" left and placed in the column that is hidden, so to speak.

      Here is a view of the design of the table:

      tableDesignView.jpg

      And a view of the execution of the table.  You can see the radio is hidden, but the "account number" column wants to crush in the (hidden) radio column,

      tableRunTimeView.jpg

      Here is the script, I'm very confident in this small snippet of code because the lines of account were filling wonderfully until I added the column of radio buttons and the script to show/hide.

      Put the account data in the table

      function

      setAccountData (objAccountRow, objAccountItem) //Pass in the line and data to complete line

      {

      stuff the line

      objAccountRow.accountNumber.rawValue

      = objAccountItem.accountNumber;

      objAccountRow.accountName.rawValue

      = objAccountItem.accountName;

      objAccountRow.accountBalance.rawValue

      = objAccountItem.accountBalance;

      display the check box or radio button, depending on the number of accounts they are allowed to select (as specified by the form variable)

      var searchNumAccounts = objFragment.resolveNode("searchNumAccounts").value; Variable //Form

          if (searchNumAccounts==1)

      { //show the column of radio buttons and hide the checkbox column }

      hideObject (objResultsSubform.accounts.HeaderRow.txtSelect);   <-it's exaggerated here, to hide the table for each row header column,...

      hideObject (objAccountRow.accountSelected);

      showObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);

      showObject (objAccountRow.radioSubform.radioGroup.selected);

      }

      on the other

      { //show the checkbox column and hide the column of radio }

      hideObject (objResultsSubform.accounts.HeaderRow.txtRadioSelect);

      hideObject (objAccountRow.radioSubform.radioGroup.selected);

      showObject (objResultsSubform.accounts.HeaderRow.txtSelect);

      showObject (objAccountRow.accountSelected);

      }

      }

      OK I got it. The table object implements a container to contain the fields. You hid the ok fields, but you then never reset the row in the table to have only two columns. I copied the parameter of the XML source so that I would have the exact width and then deleted the one I wanted to hide. Now everything works fine.

      See the example updated the.

      Paul

    • count all the columns in the tables belonged to the user

      I want to get a handle on the width of the collar of ALL tables owned by a user.
      I have this syntax to check individual tables:
      SELECT COUNT (*)
      Of user_tab_columns
      WHERE table_name = < tbl_name >;

      But, I did a DESC on the USER_TAB_COLUMNS and it is not an owner\user that I can use to get all the tbls.

      Any suggestions how I can get it to go through all the tables (I will be rolled up the output to a file)

      Hello

      USER_TAB_COLUMNS view is not the owner because all available information is on your own schema.

      The DBA_TAB_COLUMNS view has the same information more OWNER. Then, you can query the number of columns for each table of any user. For example:

      SELECT TABLE_NAME, COUNT(*)
      FROM DBA_TAB_COLUMNS
      WHERE OWNER = 'SCOTT'
      GROUP BY TABLE_NAME
      

      Or, for all schemas

      SELECT OWNER, TABLE_NAME, COUNT(*)
      FROM DBA_TAB_COLUMNS
      GROUP BY OWNER, TABLE_NAME
      ORDER BY OWNER, TABLE_NAME
      

      Kind regards
      Miguel

    • How to create a status column in the table

      Hello everyone

      I am trying to create a column of the table status in frontview Panel. I enclose a picture with her to say clearly what I say.plz tell me how to create the active status column in the table.

      I want to show green for safety stock and red for safety stock below.


    • How to find the primary key columns in the tables in MS Access using SQL queries

      How to find the primary key columns in the tables in MS Access using SQL queries

      Hello

      This is the forum for Windows Vista programs related issues.

      For better assistance, please try instead the Forums in SQL Server .

      Thank you! Vincenzo Di Russo - Microsoft MVP Windows Internet Explorer, Windows Desktop Experience & security - since 2003. ~ ~ ~ My MVP profile: https://mvp.support.microsoft.com/profile/Vincenzo

    • How can I recover only odd or even number of records in the table?

      Hello

      How can I recover only odd or even number of records in the table?

      Thank you

      Hi IndiMinds,

      Alternatively, you can use in queries. :

      Odd:

      SELECT *.

      Of

      (SELECT rownum row_count, id, name FROM bigemp

      )

      WHERE mod (row_count, 2) = 1;

      Still:

      SELECT *.

      Of

      (SELECT rownum row_count, id, name FROM bigemp

      )

      WHERE mod (row_count, 2) = 0;

      Thank you

    • Query took too much time when adding new column to the table and the index set on this

      I added a new column to the table that contains thousands of records. and created the composite index with three columns (those newly added + two existing column)

      for the specifics. TBL table there are two columns col1, col2

      I added the new column col3 to TBL and created composit index (col1, col2, col3).

      Now for all the records in col3 is NULL. When I choose on this table, it takes too long...

      Any idea what my I do bad., I have check the query plan, it is using the index

      It is solved using collection of statistics using the

      DBMS_STATS. GATHER_TABLE_STATS

      @Top.Gun thanks for your review...

    Maybe you are looking for