How to create adf columns at runtime

Hello
I want to crete a component which will display results of arbitrary sql command.
for that purpose I created 'declared component' with custom component class which obtains SQL query from passed attibute and executes it.
so in my component I have
public List<String> getColumnNames() {
if (!loaded) {
loadData();
return columnNames;
public List<List<Object>> getData() {
if (!loaded) {
loadData();
return data;
and in compDef.jspx following:
<af:table value="#{component.data}" var="row">
<af:column headerText="No">
<af:outputText value="#{row}" />
</af:column>
<af:forEach items="#{component.columnNames}" var="col" varStatus="colStatus">
<af:column headerText="#{col}">
<af:outputText value="#{row[colStatus.index]}" />
</af:column>
</af:forEach>
</af:table>
query execution is ok and component.columnNames contains several columns (checked this with af:iterator)
but it shows only 1 column (with header 'No').
If I use
<af:iterator value="#{component.columnNames}" var="col" varStatus="colStatus">
<af:column headerText="#{col}">
<af:outputText value="#{row[colStatus.index]}" />
</af:column>
</af:iterator>
it shows 4 columns instead of 2 (and doesn't show any text - that is headerText is empy and all cells are empy too)
So, can anybody tell me how is it ment to be ? Or where is the mistake ?
Version: 11g TP 4.

Thank you for your reply.
Well, if I set headers to
xx #{col} xx idx: #{colStatus.index} :idx
it shows only static text and no EL values.
(So in output I have 4 headers with text "xx xx idx: :idx")
Actually if I use suck mix of af:table and af:forEach in usual jspx file (not in component's one) - it works as expected
that is
code
<af:table value="#{Query1.data}" var="row">
<af:column headerText="xxxxx">
<af:outputText value="#{row}" />
</af:column>
<af:forEach items="#{Query1.columnNames}" var="col" varStatus="colStatus">
<af:column headerText="#{col}">
<af:outputText value="#{row [ colStatus.index ] }" />
</af:column>
</af:forEach>
</af:table>
where Query1 JSF bean performs the same functionality (executes arbitrary SQL query and stores results in data and columnNames)
works OK.
(colStatus.index is written in brackets - don't know how to disable its transformation to link, how to write preformatted code here ?)
Another point that behaviour in component's jspx is a bug - the amount of columns.
It produces 4 columns instead of 2. And I can't figure why because it doesn't show any information neither in var 'col' nor in varStatus 'colStatus'.
And if I the query returns 3 columns - number of columns in generated table is 9.
UPD. Specified behaviour is for af:iterator in the component's jspx. af:forEach produces no columns at all.
Edited by: olegk on Mar 26, 2009 11:05 AM

Similar Messages

  • How to create hashed table in runtime

    hi experts
    how to create hashed table in runtime, please give me the coading style.
    please help me.
    regards
    subhasis

    Hi,
    Have alook at the code, and pls reward points.
    Use Hashed Tables to Improve Performance :
    report zuseofhashedtables.
    Program: ZUseOfHashedTables                                        **
    Author: XXXXXXXXXXXXXXXXXX                                 **
    Versions: 4.6b - 4.6c                                              **
    Notes:                                                             **
        this program shows how we can use hashed tables to improve     **
        the responce time.                                             **
        It shows,                                                      **
           1. how to declare hashed tables                             **
           2. a cache-like technique to improve access to master data  **
           3. how to collect data using hashed tables                  **
           4. how to avoid deletions of unwanted data                  **
    Results: the test we run read about 31000 rows from mkpf, 150000   **
             rows from mseg, 500 rows from makt and 400 from lfa1.     **
             it filled ht_lst with 24500 rows and displayed them in    **
             alv grid format.                                          **
             It needed about 65 seconds to perform this task (with     **
             all the db buffers empty)                                 **
             The same program with standard tables needed 140 seconds  **
             to run with the same recordset and with buffers filled in **
    Objetive: show a list that consists of  all the material movements **
             '101' - '901' for a certain range of dates in mkpf-budat. **
    the columns to be displayed are:                                   **
             mkpf-budat,                                               **
             mkpf-mblnr,                                               **
             mseg-lifnr,                                               **
             lfa1-name1,                                               **
             mkpf-xblnr,                                               **
             mseg-zeile                                                **
             mseg-charg,                                               **
             mseg-matnr,                                               **
             makt-maktx,                                               **
             mseg-erfmg,                                               **
             mseg-erfme.                                               **
    or show a sumary list by matnr - menge                             **
    You'll have to create a pf-status called vista -                   **
    See form set_pf_status for details                                 **
    tables used -
    tables: mkpf,
            mseg,
            lfa1,
            makt.
    global hashed tables used
    data: begin of wa_mkpf, "header
          mblnr like mkpf-mblnr,
          mjahr like mkpf-mjahr,
          budat like mkpf-budat,
          xblnr like mkpf-xblnr,
          end of wa_mkpf.
    data: ht_mkpf like hashed table of wa_mkpf
          with unique key mblnr mjahr
          with header line.
    data: begin of wa_mseg, " line items
          mblnr like mseg-mblnr,
          mjahr like mseg-mjahr,
          zeile like mseg-zeile,
          bwart like mseg-bwart,
          charg like mseg-charg,
          matnr like mseg-matnr,
          lifnr like mseg-lifnr,
          erfmg like mseg-erfmg,
          erfme like mseg-erfme,
          end of wa_mseg.
    data ht_mseg like hashed table of wa_mseg
          with unique key mblnr mjahr zeile
          with header line.
    cache structure for lfa1 records
    data: begin of wa_lfa1,
          lifnr like lfa1-lifnr,
          name1 like lfa1-name1,
          end of wa_lfa1.
    data ht_lfa1 like hashed table of wa_lfa1
          with unique key lifnr
          with header line.
    cache structure for material related data
    data: begin of wa_material,
          matnr like makt-matnr,
          maktx like makt-maktx,
          end of wa_material.
    data: ht_material like hashed table of wa_material
            with unique key matnr
            with header line.
    result table
    data: begin of wa_lst, "
          budat like mkpf-budat,
          mblnr like mseg-mblnr,
          lifnr like mseg-lifnr,
          name1 like lfa1-name1,   
          xblnr like mkpf-xblnr,
          zeile like mseg-zeile,
          charg like mseg-charg,
          matnr like mseg-matnr,
          maktx like makt-maktx,
          erfmg like mseg-erfmg,
          erfme like mseg-erfme,
          mjahr like mseg-mjahr,
          end of wa_lst.
    data: ht_lst like hashed table of wa_lst
            with unique key mblnr mjahr zeile
            with header line.
    data: begin of wa_lst1, " sumary by material
          matnr like mseg-matnr,
          maktx like makt-maktx,
          erfmg like mseg-erfmg,
          erfme like mseg-erfme,
          end of wa_lst1.
    data: ht_lst1 like hashed table of wa_lst1
            with unique key matnr
            with header line.
    structures for alv grid display.
    itabs
    type-pools: slis.
    data: it_lst            like standard table of wa_lst with header line,
          it_fieldcat_lst   type slis_t_fieldcat_alv with header line,
          it_sort_lst       type slis_t_sortinfo_alv,
          it_lst1           like standard table of wa_lst1 with header line,
          it_fieldcat_lst1  type slis_t_fieldcat_alv with header line,
          it_sort_lst1      type slis_t_sortinfo_alv.
    structures
    data: wa_sort         type slis_sortinfo_alv,
          ls_layout       type slis_layout_alv.
    global varialbes
    data: g_lines type i.
    data: g_repid like sy-repid,
          ok_code       like sy-ucomm.
    selection-screen
    "text: Dates:
    select-options: so_budat for mkpf-budat default sy-datum.
    "text: Material numbers.
    select-options: so_matnr for mseg-matnr.
    selection-screen uline.
    selection-screen skip 1.
    "Text: show summary by material.
    parameters: gp_bymat as checkbox default ''.
    start-of-selection.
      perform get_data.
      perform show_data.
    end-of-selection.
          FORM get_data                                                 *
    form get_data.
            select mblnr mjahr budat xblnr
                into table ht_mkpf
               from mkpf
              where budat in so_budat. " make use of std index.
    have we retrieved data from mkpf?
      describe table ht_mkpf lines g_lines.
      if g_lines > 0.
    if true then retrieve all related records from mseg.
    Doing this way we make sure that the access is by primary key
    of mseg.
    The reason is that is faster to filter them in memory
    than to allow the db server to do it.
        select mblnr mjahr zeile bwart charg
                 matnr lifnr erfmg erfme
          into table ht_mseg
          from mseg
            for all entries in ht_mkpf
         where mblnr = ht_mkpf-mblnr
           and mjahr = ht_mkpf-mjahr.
      endif.
    fill t_lst or t_lst1 according to user's choice.
      if gp_bymat = ' '.
        perform fill_ht_lst.
      else.
        perform fill_ht_lst1.
      endif.
    endform.
    form fill_ht_lst.
      refresh ht_lst.
    Example: how to discard unwanted data in an efficient way.
      loop at ht_mseg.
      filter unwanted data
        check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
        check ht_mseg-matnr in so_matnr.
      read header line.
        read table ht_mkpf with table key mblnr = ht_mseg-mblnr
        mjahr = ht_mseg-mjahr.
        clear ht_lst.
    * note : this may be faster if you specify field by field.
        move-corresponding ht_mkpf to ht_lst.
        move-corresponding ht_mseg to ht_lst.
        perform read_lfa1 using ht_mseg-lifnr changing ht_lst-name1.
        perform read_material using ht_mseg-matnr changing ht_lst-maktx.
        insert table ht_lst.
      endloop.
    endform.
    form fill_ht_lst1.
      refresh ht_lst1.
    Example: how to discard unwanted data in an efficient way.
             hot to simulate a collect in a faster way
      loop at ht_mseg.
      filter unwanted data
        check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.
        check ht_mseg-matnr in so_matnr.
    * note : this may be faster if you specify field by field.
        read table ht_lst1 with table key matnr = ht_mseg-matnr
        transporting erfmg.
        if sy-subrc <> 0. " if matnr doesn't exist in sumary table
        " insert a new record
          ht_lst1-matnr = ht_mseg-matnr.
          perform read_material using ht_mseg-matnr changing ht_lst1-maktx.
          ht_lst1-erfmg = ht_mseg-erfmg.
          ht_lst1-erfme = ht_mseg-erfme.
          insert table ht_lst1.
        else." a record was found.
        " collect erfmg.  To do so, fill in the unique key and add
        " the numeric fields.
          ht_lst1-matnr = ht_mseg-matnr.
          add ht_mseg-erfmg to ht_lst1-erfmg.
          modify table ht_lst1 transporting erfmg.
        endif.
      endloop.
    endform.
    implementation of cache for lfa1.
    form read_lfa1 using p_lifnr changing p_name1.
            read table ht_lfa1 with table key lifnr = p_lifnr
            transporting name1.
      if sy-subrc <> 0.
        clear ht_lfa1.
        ht_lfa1-lifnr = p_lifnr.
        select single name1
           into ht_lfa1-name1
          from lfa1
        where lifnr = p_lifnr.
        if sy-subrc <> 0. ht_lfa1-name1 = 'n/a in lfa1'. endif.
        insert table ht_lfa1.
      endif.
      p_name1 = ht_lfa1-name1.
    endform.
    implementation of cache for material data
    form read_material using p_matnr changing p_maktx.
      read table ht_material with table key matnr = p_matnr
      transporting maktx.
      if sy-subrc <> 0.
        ht_material-matnr = p_matnr.
        select single maktx into  ht_material-maktx
          from makt
         where spras = sy-langu
           and matnr = p_matnr.
        if sy-subrc <> 0. ht_material-maktx = 'n/a in makt'. endif.
        insert table ht_material.
      endif.
      p_maktx = ht_material-maktx.
    endform.
    form show_data.
      if gp_bymat = ' '.
        perform show_ht_lst.
      else.
        perform show_ht_lst1.
      endif.
    endform.
    form show_ht_lst.
      "needed because the FM can't use a hashed table.
      it_lst[] = ht_lst[].
      perform fill_layout using 'full display'
                           changing ls_layout.
      perform fill_columns_lst.
    perform sort_lst.
      g_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = g_repid
                i_callback_pf_status_set = 'SET_PF_STATUS'
                is_layout                = ls_layout
                it_fieldcat              = it_fieldcat_lst[]
               it_sort                  = it_sort_lst
           tables
                t_outtab                 = it_lst
           exceptions
                program_error            = 1
                others                   = 2.
    endform.
    form show_ht_lst1.
      "needed because the FM can't use a hashed table.
      it_lst1[] = ht_lst1[].
      perform fill_layout using 'Sumary by matnr'
                           changing ls_layout.
      perform fill_columns_lst1.
    perform sort_lst.
      g_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = g_repid
                i_callback_pf_status_set = 'SET_PF_STATUS'
                is_layout                = ls_layout
                it_fieldcat              = it_fieldcat_lst1[]
               it_sort                  = it_sort_lst
           tables
                t_outtab                 = it_lst1
           exceptions
                program_error            = 1
                others                   = 2.
    endform.
    form fill_layout using p_window_titlebar
                   changing cs_layo type slis_layout_alv.
      clear cs_layo.
      cs_layo-window_titlebar        = p_window_titlebar.
      cs_layo-edit                   = 'X'.
      cs_layo-edit_mode              = space.
    endform.                    " armar_layout_stock
    form set_pf_status using rt_extab type slis_t_extab.
    create a new status
    and then select extras -> adjust template -> listviewer
      set pf-status 'VISTA'.
    endform.        "set_pf_status
    define add_lst.
      clear it_fieldcat_lst.
      it_fieldcat_lst-fieldname     = &1.
      it_fieldcat_lst-outputlen     = &2.
      it_fieldcat_lst-ddictxt       = 'L'.
      it_fieldcat_lst-seltext_l       = &1.
      it_fieldcat_lst-seltext_m       = &1.
      it_fieldcat_lst-seltext_m       = &1.
      if &1 = 'MATNR'.
        it_fieldcat_lst-emphasize = 'C111'.
      endif.
      append it_fieldcat_lst.
    end-of-definition.
    define add_lst1.
      clear it_fieldcat_lst.
      it_fieldcat_lst1-fieldname     = &1.
      it_fieldcat_lst1-outputlen     = &2.
      it_fieldcat_lst1-ddictxt       = 'L'.
      it_fieldcat_lst1-seltext_l       = &1.
      it_fieldcat_lst1-seltext_m       = &1.
      it_fieldcat_lst1-seltext_m       = &1.
      append it_fieldcat_lst1.
    end-of-definition.
    form fill_columns_lst.
    set columns for output.
      refresh it_fieldcat_lst.
      add_lst 'BUDAT' 10.
      add_lst   'MBLNR' 10.
      add_lst  'LIFNR' 10.
      add_lst  'NAME1' 35.
      add_lst  'XBLNR' 15.
      add_lst    'ZEILE' 5.
      add_lst    'CHARG' 10.
      add_lst   'MATNR' 18.
      add_lst   'MAKTX' 30.
      add_lst   'ERFMG' 17.
      add_lst   'ERFME' 5.
      add_lst   'MJAHR' 4.
    endform.
    form fill_columns_lst1.
    set columns for output.
      refresh it_fieldcat_lst1.
      add_lst1 'MATNR' 18.
      add_lst1 'MAKTX' 30.
      add_lst1 'ERFMG' 17.
      add_lst1 'ERFME' 5..
    endform.
    Regards,
    Ameet

  • How to Create adf table from java bean

    Hi,
    How to Create adf table from java class (Not from ADF BC).
    Thanks
    Satya

    @vlsn -- you have to follow what shay said.
    Do the following in Model layer ::
    create a table property java class with your columns setters and getters like :
    *public class gridProps {*
    private int sno;
    private String orderNum;
    *public void setSno(int sno) {*
    this.sno = sno;
    *public int getSno() {*
    return sno;
    *public void setOrderNum(String orderNum) {*
    this.orderNum = orderNum;
    *public String getOrderNum() {*
    return orderNum;
    Create another table java class which will populate the values to your column values and return the collection :
    *public class gridPopulate {*
    private  List<gridProps> gridValues ;
    *public List<gridProps> setToGrid(ArrayList<ArrayList> valuesToSet) {*
    *if (valuesToSet == null) {*
    return gridValues;
    gridValues = new ArrayList<gridProps>();
    if(btnValue.equals("completeBtn"))
    return gridValues;
    for(ArrayList<String> tempArr:valuesToSet)
    gridProps gp = new gridProps();
    gp.setSno(Integer.valueOf(tempArr.get(0)));
    gp.setOrderNum(tempArr.get(1));
    return gridValues;
    Right click gridPopulate class and create this as data control.This class will be seen in Data control list.Under this data control,Drag the grid property collection(created earlier) to your page.Then execute your binding(gridPopulate) according to your logic.
    Thanks.(My jdev version 11.1.1.5.0)

  • How to create  some columns dynamically in the report designer depending upon the input selection

    Post Author: ekta
    CA Forum: Crystal Reports
    how  to create  some columns dynamically in the report designer depending upon the input selection 
    how  export  this dynamic  report in (pdf , xls,doc and rtf format)
    report format is as below:
    Element Codes
    1
    16
    14
    11
    19
    10
    2
    3
    Employee nos.
    Employee Name
    Normal
    RDO
    WC
    Breveavement
    LWOP
    Sick
    Carers leave
    AL
    O/T 1.5
    O/T 2.0
    Total Hours
    000004
    PHAN , Hanh Huynh
    68.40
    7.60
    76.00
    000010
    I , Jungue
    68.40
    7.60
    2.00
    5.00
    76.00
    000022
    GARFINKEL , Hersch
    66.30
    7.60
    2.10
    76.00
    In the above report first column and the last columns are fixed and the other columns are dynamic depending upon the input selection:
    if input selection is Normal and RDO then only 2 columns w'd be created and the other 2 fixed columns.
    Can anybody help me how do I design such report....
    Thanks

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • Is it possible to create a column in  runtime?

    Hi,
    I created a application that connect with Access database. I just wonder is it possible for user to create a column in runtime, because the application need this kind of interaction.
    Many thanks,
    Ann

    Here's code to do that
         static void addColumn(Connection dbConn, String cname)
              Statement ins;
              String sql = "ALTER TABLE TestTable ADD "+cname+" CHAR(20)";
              try
                   ins = dbConn.createStatement();
                   ins.executeUpdate(sql);
                   ins.close();
              catch (SQLException se){fail(se);}
         }The rest of my TestODBC example can be found at
    http://forum.java.sun.com/thread.jsp?forum=31&thread=453376

  • How to create dynamics columns in oracle query1.

    hi,
    how to create dynamics columns in oracle query.its very urgent.
    regards
    prasad..

    Urgent is it?
    Why? Have you forgotten to do your coursework and you'll get thrown off your course if you don't hand it in today?
    What makes you believe that your request for help is more important than someone else who has requested help? It's very rude to assume you are more important than somebody else, and I'm sure they would like an answer to their issue as soon as they can get one too, but they've generally been polite and not demanded that it is urgent.
    Also, you assume that people giving answers are all sitting here just waiting to answer your question for you. That's not so. We're all volunteers with our own jobs to do. How dare you presume to demand our attention with urgency.
    If you want help and you want it answering quickly you simply just put your issue forward and provide as much valuable information as possible.
    Looking at your post you haven't told us what database version you are using, you haven't provided any create table DDL's and insert statements to populate that with sample data, and you haven't even shown us that you've had a go at doing something yourself.
    You will find if you post on here demanding your post is urgent then most people will just ignore it, some will tell you to get lost, and some will explain to you why you shouldn't post "urgent" requests. Occasionally you may find somebody who's got nothing better to do who will actually provide you with an answer, but you really are limiting your options by not asking properly.
    /rant
    As a basic example of dyanamic SQL:
    DECLARE
      cur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
      cols DBMS_SQL.DESC_TAB;
      ncols PLS_INTEGER;
    BEGIN
      -- Parse the query.
      DBMS_SQL.PARSE(cur, 'SELECT hiredate, sal FROM emp', DBMS_SQL.NATIVE);
      -- Retrieve column information
      DBMS_SQL.DESCRIBE_COLUMNS (cur, ncols, cols);
      -- Display each of the column names
      FOR colind IN 1 .. ncols
      LOOP
        DBMS_OUTPUT.PUT_LINE (cols.col_name);
      END LOOP;
      DBMS_SQL.CLOSE_CURSOR (cur);
    END;
    /

  • How to create sub columns in interactive report

    can u tell me , how to create sub columns in
    interactive report. i really need it.i search lot but i dont get proper information.
    help plz...
    example : -
    |_____total_ persons _____|
    | persons | male | female |
    100 200 3000
    400 500 600

    i am nile.
    select id as id,
    male as male,
    female as female
    from persons.
    i want interactive report with main column total persons(static text) in that male , female.
    e.g.
    |___total persons_| - - - - -> main cloumn
    | male | female | - - - - -> sub columns
    100 200
    300 400
    Edited by: user9512075 on Aug 29, 2008 1:46 AM
    Edited by: user9512075 on Aug 29, 2008 1:47 AM
    Edited by: user9512075 on Aug 29, 2008 1:48 AM
    Edited by: user9512075 on Aug 29, 2008 1:49 AM

  • How to create two columns in a header?

    Can anyone tell me how to create two columns in a header please?
    Thanks!!

    Sandra,
    I'm suspicious about your motives.  It just doesn't seem logical to me to put so much content into a Header that two columns would be required.
    You might consider the alternate header-like approach; use a Text Box set to two-column format and Format > Advanced > Move Object to Section Master.
    Jerry

  • Create ADF Table at runtime

    Hi,
    I am trying to create ADF table at run time. Initially I tried to include all the tables at design time. Then I turned the setVisible property to false. Then , based on the condition, I turned it to true at runTime, so that to give the effect of the table getting created at run time.
    But now, I would like to know , is there any option to extract the table component from the ViewObject or from the iterator, at run time.
    say,
    I have my ViewObject like this.
    DCIteratorBinding dcIter=(DCIteratorBinding)bindings.getControlBinding("Table1View1Iterator");
    ViewObject vo=dcIter.getViewObject();
    Now, I have a panel, 'pb1'. I am able to add input boxes at run time. Now I want to add the table that corresponds to the above View also at run time.
    Could someone pls give me the suggestion..
    Thanks,
    Sabarisri. N

    well, in that case you can create table dynamically from managed bean. I am giving you a sample code which add row dynamically to a table on click of "Add" button.
    jspx code:
    <af:document id="d1" title="XXXX">
          <af:form id="f1">
            <af:commandButton text="Add" id="cb1" action="#{MyBean.add}"/>
            <af:table varStatus="rowStat" summary="table"
                      value="#{MyBean.collectionModel}"
                      rows="#{MyBean.collectionModel.rowCount}"
                      rowSelection="none" contentDelivery="immediate" var="row"
                      rendered="true" id="t1">
              <af:forEach items="#{MyBean.columnNames}"
                          var="name">
                <af:column sortable="true" sortProperty="#{name}"
                           rowHeader="unstyled" headerText="#{name}"
                           inlineStyle="width:100px;" id="c1">
                  <af:activeOutputText value="#{row[name]}" id="aot1"/>
                </af:column>
              </af:forEach>
            </af:table>
          </af:form>
        </af:document>managed bean:
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import org.apache.myfaces.trinidad.model.CollectionModel;
    import org.apache.myfaces.trinidad.model.SortableModel;
    public class MyBean {
        private SortableModel model;
        private List<String> columnNames;
        public MyBean() {
            System.out.println("Cntl in MyBean constructor :::");
            columnNames = new ArrayList<String>();
            columnNames.add("Col-1");
            columnNames.add("Col-2");
    //        generateColumnModel();
        public void generateColumnModel() {
            this.model = new SortableModel(createRows(columnNames));
        private static List<Map> createRows(List<String> columnNames) {
            int i = 0;
            List<Map> mapListforRows = new ArrayList<Map>();
            //for (String name : columnNames) {
                Map newRow = new HashMap();
                mapListforRows.add(newRow);
                for (String col : columnNames) {
                    newRow.put(col, "data");
            return mapListforRows;
        public String add() {
            System.out.println("Cntl in add method :::");
    //        columnNames = new ArrayList<String>();
    //        columnNames.add("Col-1");
    //        columnNames.add("Col-2");
            generateColumnModel();
            return null;
        public CollectionModel getCollectionModel() {
            return model;
        public void setColumnNames(List<String> columnNames) {
            this.columnNames = columnNames;
        public List<String> getColumnNames() {
            return columnNames;
    }I hope this will help you to solve your use case
    ~Abhijit

  • How to create adf-settings.xml

    hi
    The blog post "How to configure an ADF Phase Listener and where to put the file " by Frank Nimphius
    at http://blogs.oracle.com/jdevotnharvest/entry/how_to_configure_an_adf_phase_listener_and_where_to_put_the_file
    says "... To configure the adf-settings.xml file, create the file as shown below in the .adf\META-INF directory of your application ..."
    But how to create a file in the .adf\META-INF directory using JDeveloper seems to have some confusing documentation:
    - section "A.5.1 How to Configure for ADF Faces in adf-settings.xml"
    at http://docs.oracle.com/cd/E21764_01/web.1111/b31973/ap_config.htm#ADFUI9840
    in "Oracle® Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1.5.0) Part Number B31973-09 "
    says
    "To create and edit adf-settings.xml:
    1. If not already created, create a META-INF directory for your project.
    2. Right-click the META-INF directory, and choose New from the context menu. ..."
    Using JDeveloper 11.1.1.5.0 creating a Fusion Web Application (ADF) the .adf\META-INF directory seems to exist, but there does not seem to be a way to "Right-click the META-INF directory, and choose New from the context menu." as documented.
    - section "A.5.1 How to Configure for ADF Faces in adf-settings.xml "
    at http://docs.oracle.com/cd/E24382_01/web.1112/e16181/ap_config.htm#ADFUI9840
    in "Oracle® Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework 11g Release 2 (11.1.2.1.0) Part Number E16181-02 "
    says
    "To create and edit adf-settings.xml:
    1. If not already created, create a META-INF directory for your project in the Application Sources folder (.adf\META-INF).
    2. Right-click the META-INF directory, and choose New from the context menu. "
    Using JDeveloper 11.1.2.1.0 creating a Fusion Web Application (ADF) there seems to be a ViewController\src\META-INF\adf-settings.xml file created by default. Note that it is not in .adf\META-INF but in ViewController\src\META-INF .
    - (q1) What are the specific steps to create adf-settings.xml in the correct location using JDeveloper?
    many thanks
    Jan Vervecken

    Jan,
    I am actually testing this with 11g R2 PS2 (upcoming) and for me the adf-settings.xml file is not created, which I am confused of. The 11.1.1.6 documentation has been updated with
    *"By default, there is an adf-settings.xml file created for you in the view_project/src/META-INF directory."*
    This leaves room for interpretation
    i) adf-settings.xml are created in th eproject directory for the reason mentioned in an older thread that this is better for workspaces that contain two projects with controller settings
    ii) where there is a "by-default" there must be a non-default, which could indicate the location I used in the blog
    The documentation then goes:
    To create and edit adf-settings.xml:
    If one does not already exist, create a META-INF directory in the src directory of your view project (you will need to do this outside of JDeveloper).
    Note:*
    If you are using ADF Model in your application, then the directory will already exist in the application_name/.adf directory.*
    Which seems odd. Though it confirms the application wide configuration I used, why would you have the default created for the View Layer project and the manual one you create in the application wide configuration. So it seems that there indeed is a missing guidance on where this file should go into.
    So it seems you still will have to wait for a final answer on this. Note that adf-settings.xml is not only used by the controller, which may mean you can have multiple locations (and multiple files?). I'll try and do a bit more research on this. For now, as you say the listeners work for you, I suggest you leave them with the ViewLayer project. I am wondering if the adf-settings.xml file gets deployed with an Adf Library (will check this) in which case the right answer would be to save it in the view project.
    Frank

  • How to create a column where each subsequent entry is added to the former?

    How does one create a column, inside Numbers, where each subsequent cell is added, in value, to the preceding cell above it? For example, a column could be labeled "credit card subtotals for the month." In the first cell, one might insert a dollar value, eg., $24.00. The next credit card charge might be $100.00 and that would be added to the $24.00 to create a running subtotal.
    Thank you.

    Hi Jay,
    Both formulas are written as they would appear entered into C2.
    The 'special formula' is also written as it would appear in C2. Where I have used 'formula for C2' substitute your choice of the two formulas listed above the 'special formula' in my earlier post.
    If you choose to use the first version, the finished 'special formula' will look like this in C2:
    =IF(LEN(B2)>0,SUM(C1,B2),"")
    Jerry's remarks regarding using conditional formatting to suppress the display of zeroes is well taken, but in this case, will not work as there are no zero values to be hidden.
    In this case, either of the initial formulas will repeat the last 'running balance' in every cell from the last row containing an entry in column B to the bottom row of the table.
    The formula checks, by counting the number of characters displayed, whether an entry has been made in the column B cell on the same row as the formula (B2 in the example in this post. IF an entry has been made, the formula calculates the sum of that entry and the previous running balance. IF no entry has been made (ie. there are no chanracters displayed in B2, the calculation is skipped, and the empty string ( "" ) is placed in C2, giving the appearance of a blank cell.
    Example:  the formula in this post is used in column C. Column D uses the core of that formula (with the C1 reference replaced by D1) without the IF statement. Both formulas are filed down to the bottom cell in their columns. Note the difference in rows 7 and below:
    Regards,
    Barry

  • How to create New columns for the Internal Table Dynamically?

    HI Guys,
                          In my logic i have to create new columns depending on the logic which i am executing.
    My requirement is .I have to display o/p like this
    Material || Year || Period  ||  Mix ratio || Vendor ||Mix Ratio || Vendor || Mix Ratio Vendor || Mix ratio || Vendor || Mix ratio.............................from table's CKMLMV003 and CKMLMV001.Her i have to display the o/p in the above format and i have to display Vendor and Mix Ratio for 5 columns irrespective of data .If i have more than 5 columns for any record then i have to create a New columns dynamically for Vendor and Mix ratio.If anybody want my code i can Submit But plz tell with example how to do?
                    <b>The O/P must be finally shown in ALV Grid</b>
    Thanks,
    Gopi

    You must create the entire internal table dynamically, you can not add columns to a statically define internal table.  Here is an example of creating a dynamic internal table.
    Creation of internal table dynamically based on the Date Range entered
    Regards,
    Rich Heilman

  • How to create a column that automatically creates a serial number?

    How can I create a column that creates a serial number for each entry?

    you could do something like this:
    I assumed that the serial number only needs to be present if you have entered some information in the other columns of the corresponding row.
    A2=IF(COUNTA(2:2)>0, REPT("0", 6−LEN(ROW()−1))&ROW()−1, "")
    this is shorthand for... select cell A2, then type (or copy and paste from here) the formula:
    =IF(COUNTA(2:2)>0, REPT("0", 6−LEN(ROW()−1))&ROW()−1, "")
    To fill down:
    select cell A2, copy
    select column A by clicking the columne header (the "A" at the very top)
    unselect cell A1 by holding the command key while single clicking cell A1
    paste

  • How to create table columns dynamically ?

    Hi All,
    I am working on an SSRS report that will show sales in the past 5 years. If the user selected to view sales of past 3 years he will only see 3 columns. so How can I create table columns dynamically at run time and how can I make sure that their dimensions
    will adjust to fit the report page size.

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • How to create logical column...

    Hi experts,
    i am new in using obiee... i would like to ask how to create a logical column based on a select statement. i have a column report_date and the logical column will be a distinct year-month of that column.. please refer below..
    REPORT_DATE
    7/1/2006
    7/1/2006
    8/23/2007
    8/26/2007
    6/3/2008
    6/9/2008
    this is the format i want to have in my logical column..
    2006-7
    2007-8
    2008-6
    thanks in advance... :)

    hi,
    thank you for your reply, i just created a view just to have a column with the data that i want then used the column in the business layer.. :D

Maybe you are looking for

  • # of PO's and # of Returns

    Hi all, I have a requirement where in need the number of POs and Returns for each vendor. I want to get this information with 0PUR_C01 cube. This cube is fed by a DSO object containing all Order Items (0PUR_O01). Can you tell me which is the best way

  • Acrobat 9.0 Pro Error

    Acrobat Pro 9.0.0 XP Prof SP3 Office 2007 A black box appears instead of a chart when I paste a Microsoft Office Graphic Object into a document versus a Picture (Enhanced Metafile) when the document gets converted into Adobe. Any ideas? Your help is

  • Mail uses 100% CPU, then says there are 0 messages in mailboxes

    Hi all, I just decided to switch from thunderbird back to mail for various reasons. So I imported all my t-bird mail boxes successfully by copying the mailboxes and adding the .mbox extension, as suggested by someone somewhere on the internet. Mail s

  • Import web service from service registry into web dynpro

    HI, when i import web service into web dynpro model, it asks me to create service group or if i choose no service group configure, it ask me the destionation for metadata and excution. i import service from service registry. what does the service con

  • HT201210 i can't add app icons to my phone.

    I completed the update of ios 7 and had app icons on my phone.  Now they are on my App store and I can open them but I can't add the icon of that app to my phone.  How do I get that Icon back on my phone?