How to display dynamic column added by vo.addDynamicAttribute in jspx?

Hi,
I met problem when programmatically add cloumn and display it on screen. Here are my steps:
0. define a ViewObject using xml. Define a transient column Addtion2. later will add a dynamic column Addtion3, but not defined here.
1. Implement Application Module, adding a method init() and expose it to client.
2. In init() method, get target VO and use vo.addDynamicAttribute("Addition3"). Then iterate it use row.setAttribute("Addition3", Math.random()). Add init() to page binding and invoke it.( it's invoked )
3. In jspx, use dynamic table. But Addition3 never shows up.
This is my last question: Re: How to display dynamic column added by vo.addDynamicAttribute in jspx? People say I should use dynamic table.
please have a look at my code:
Application Module: when it runs, it will print 6 coulmns. vo.getAttributeCount() is <font color="red">6</font>.
<pre>
public void init() {
ViewObject vo = this.getCountryView1();
if (vo.getAttributeIndexOf("Addition3") == -1) {
vo.addDynamicAttribute("Addition3");
vo.executeQuery();
for (AttributeDef deft : vo.getAttributeDefs()) {
System.out.println(deft.getColumnName() + ": " + deft.getName());
RowSetIterator it = vo.createRowSetIterator("i1");
while (it.hasNext()) {
Row r = it.next();
r.setAttribute("Addition2", Math.random());
r.setAttribute("Addition3", Math.random());
it.closeRowSetIterator();
for (AttributeDef deft : vo.getAttributeDefs()) {
System.out.println(deft.getColumnName() + ": " + deft.getName());
System.out.println(vo.getAttributeCount()); //vo.getAttributeCount() is 6
</pre>
jspx: when it runs, only 5 columns are shown. Column Addition2's values are set as expected. but Column Addition3 never shows up. And #{bindings.CountryView1.attributeCount} shows <font color="red">5</font>.
<pre>
<af:table rows="#{bindings.CountryView1.rangeSize}"
fetchSize="#{bindings.CountryView1.rangeSize}"
emptyText="#{bindings.CountryView1.viewable ? 'No data to display.' : 'Access Denied.'}"
var="row" rowBandingInterval="0"
value="#{bindings.CountryView1.collectionModel}"
selectedRowKeys="#{bindings.CountryView1.collectionModel.selectedRow}"
selectionListener="#{bindings.CountryView1.collectionModel.makeCurrent}"
rowSelection="single" id="t1">
<af:forEach items="#{bindings.CountryView1.attributeDefs}" var="def">
<af:column headerText="#{def.name}"
sortable="true" sortProperty="#{def.name}" id="c1">
<af:outputText value="#{row[def.name]}" id="ot1"/>
</af:column>
</af:forEach>
</af:table>
<af:forEach items="#{bindings.CountryView1.attributeDefs}" var="def">
<af:outputText value="#{def.name}" id="ot2"/>
</af:forEach>
<af:outputText value="#{bindings.CountryView1.attributeCount}" id="ot3"/>
</pre>
it's quite weird for me. The vo.getAttributeCount() is 6, but #{bindings.CountryView1.attributeCount} shows 5. And column Addtion3 never shows up.
what's the matter? How can I show the dynamic added column Addtion3?
Edited by: simon li on 2012-9-10 下午7:31
Edited by: simon li on 2012-9-10 下午8:00

Hi,
Can you check the tree binding (CountryView1 - in the pagedef) and see it has the 5 attributes hardcoded in it. If yes, try removing everything and then run the page to see if it works fine.
-Arun

Similar Messages

  • Displaying dynamic columns in the query output.

    Hello,
    Depending on current quarter output of the query would vary.
    If current quarter is 'Q1'
    O/p : InvQ1  Del  BackQ1  BackQ2  BackQ3  BackQ4
    If current quarter is 'Q2'
    O/p : InvQ1  InvQ2  Del  BackQ2  BackQ3  BackQ4
    If current quarter is 'Q3'
    O/p : InvQ1  InvQ2  InvQ3  Del  BackQ3  BackQ4
    If current quarter is 'Q4'
    O/p : InvQ1  InvQ2  InvQ3  InvQ4  Del  BackQ4
    So, out of 9 columns, 6 columns would display at any given time depending on the current quarter.
    Invoice of 4 quarters, Deliquency and Backlog of 4 quarters.
    I am not getting any way how to display dynamic columns or hide unwanted/blank columns.
    For the time being I have added all 9 columns in the query, and in the output unwanted columns shows blank.
    Can anybody please suggest me how to display only 6 columns in the output depending on current quarter.
    Thanks and Regards
    Shilpa

    Hello,
    This shouldn't be too difficult. Assuming you have a variable with the selected quarter, you may choose to display Inv (whatever that is) for quarters 1 through variable, Del, and Back for quarters variable through 4. You also need a drilldown on quarter in the columns (after the key figure structure). You would probably need to restrict 'Del' on the variable as well if you haven't already done it.
    Best regards,
    Christoffer

  • How to Display Sub-Columns using ALV Grid

    Hi ,
      Could someone tell me how to display sub-columns under a parent column using ALV Grid. Do we have any standard Program which has this scenario. Please let me know.
    Thanks,
    Abaper.
    Message was edited by:
            ABAP'er

    you can check all with <b>BCALV* or RSDEMO*</b> in SE38 for all Std
    check below
    BCALV_DND_01                   Drag ALV Row to Tree Folder
    BCALV_DND_02                   Drag Icons from Tree to Rows of the Grid
    BCALV_GRID_DND_TREE            ALV Grid: Drag and Drop with ALV Tree
    BCALV_GRID_DND_TREE_SIMPLE     ALV GRID: Drag and drop with ALV tree (simple)
    BCALV_TEST_COLUMN_TREE         Program BCALV_TEST_COLUMN_TREE
    Rewards if useful............
    Minal

  • How to Display Sub-Columns using ALV

    Hi experts,
        Could someone tell me how to display sub-columns under a parent column using ALV. Do we have any standard Program which has this scenario. points are guaranteed for the right answer.
    Thanks in advance
    Sreenivas

    you can check all with <b>BCALV* or RSDEMO*</b> in SE38 for all Std
    check below
    BCALV_DND_01                   Drag ALV Row to Tree Folder
    BCALV_DND_02                   Drag Icons from Tree to Rows of the Grid
    BCALV_GRID_DND_TREE            ALV Grid: Drag and Drop with ALV Tree
    BCALV_GRID_DND_TREE_SIMPLE     ALV GRID: Drag and drop with ALV tree (simple)
    BCALV_TEST_COLUMN_TREE         Program BCALV_TEST_COLUMN_TREE
    Rewards if useful............
    Minal

  • How to add  dynamic column  in jfreereport

    hi,
    i am working on a project aboit accounting package.
    i had created a report in jfreereport .. buti am facing the problem of dynamic column addition in that..
    i have to create the number of column as per user given range that will from 2 to 365
    i had generated column for that
    that should be like
    1 - 5 , 6 -10 , 11 - 15 , etc...
    how can i represent that alll column in print preview i can't represent that report in horizontal fashion . is there any way to display it ..
    this report has no bound in horizontal or verticle means i have any number of rows or columns..
    pls help.
    kamlesh

    hi,
    that means u have fixed columns right? ie 5 columns in a report
    if it write, than u can find out how u can rename the columns with exiting
    one.
    that means while runing report u have to pass all the 5 columns to report
    instead of the exiting columns (ie rename the columns that u want add
    columns)
    u have to search in code for renaming in the code ie jfreereport package.
    i think u understood.
    daya

  • HOW to add Dynamic Columns in ADF Faces CORE Table

    In ADF im going to display the dynamic column in Coretable,
    Header are displaying very fine. but im unable to display rows sucessfuly,how to resolve.
    Second thing is that JSF page isn't getting the value from dataList, whats wrong in JSF code.
    // JSF PAGE CODE
         <af:table binding="#{backing_test1.table1}" id="table1"
    value="{backing_test1.dataList}" var="myRec"/>
         public void setTable1(CoreTable table1) {
         this.table1 = table1;
         public CoreTable getTable1() {
    //create this table
    table1 = new CoreTable();
    CoreColumn dynamicCol;
    CoreOutputText outText;
    Application app=FacesContext.getCurrentInstance().getApplication();
    DCIteratorBinding iter = (DCIteratorBinding)bindings.get("listAllMonthsIter");
    RowSetIterator rsIter = iter.getRowSetIterator();
    rsIter.reset();
    Row row;
    while (rsIter.hasNext()) {
    row = rsIter.next();
    String header = (String)row.getAttribute("element");
    // element contain the value JAN, FEB...
    dynamicCol = new CoreColumn();
    dynamicCol.setHeaderText(header);
    String currRec = table1.getVar();
    outText = new CoreOutputText();
    ValueBinding vb = app.createValueBinding("#{myRec.value}");
    outText.setValueBinding("value",vb);
    outText.setRendererType("Text");
    dynamicCol.getChildren().add(outText);
    table1.getChildren().add(dynamicCol);
    public void setDataList(List dataList) {
    this.dataList = dataList;
    public List getDataList() {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding =
    bindings.getOperationBinding("listAllMonths");
    if (operationBinding == null)
    return null;
    List dataList = (Vector)operationBinding.execute();
    return dataList;
    }

    Well issue is that
    I have a list of values that can be chnaged any time during application execution sya its list of Fav Fruits..
    and in an other page i need a data table having these fruits as coulmns and their details as rows...
    how to achieve this..
    we can not guess the number of columns before time.. so can make the estimate and hide them.

  • OBIEE:How to display row/columns where no data is present in pivot results?

    I have a request from some team members to provide an OBIEE report of 7 teams and the number of open incidents for each team by week.
    I was able to create the pivot listing the teams vertically and the age (by week#: 1 week, 2 weeks, 3 weeks, 4 weeks & > 4weeks) horizontally.
    The dilemma I have is that of the 7 teams that have incidents tickets only 4 of them have data, thus only those 4 teams that have ticket data show up in my pivot. I would like to be able to reflect ALL 7 teams even if representing a dash or null value across the pivot for those teams that don't have data.
    Does anyone know if this is possible and if so, how would I do this? I've tried searching the internet and found out how to replace a null value with a dash in columns/rows when a cell is null. But not how to display an entire row (or column) where no data is present.
    Edited by: coutya on May 22, 2012 11:01 AM
    Edited by: coutya on May 22, 2012 11:02 AM

    You are correct; if there are no data at all, those teams won't show in a pivot table. NULLs or dashes only work if a particular column is null. There are two ways to accomplish what you wish. The first example I thought when I wasn't aware of being able to do a LEFT OUTER JOIN in Answers using the Advanced tab. The first method works nicely, though and is simpler to execute.
    Read my solution here:
    Re: Section Values showing NULL in Pivot
    To do the LEFT OUTER JOIN read this:
    http://gerardnico.com/wiki/dat/obiee/multiple_subject_area
    Both will get you what you want...

  • How to display dynamic signature in Smartforms?

    Hi,
    Someone could help me in displaying dynamic signatures in SmartForms?. The signature is an attached file to the document. I already have the binary file but I don't know how to display this as an image in the Smartforms.
    Thanks in advance,
    Oliver
    Message was edited by: Oliver Vera
    Message was edited by: Oliver Vera

    Please give me the reply.
    I have an image content in one internal table.I want to display that image in the smartforms.
    plaese please.

  • How to display the column header in two rows?

    Hi Experts,
    I am using ALV_LIST_DISPLAY i neeed to display the column header in two rows.. How can i do that?
    Ex: purchase order i  need to display "purchase" in one row and "order" in second row.
    Thanks in advance,
    Sarath.j

    REPORT zpwtest .
    TYPE-POOLS slis .
    DATA : layout TYPE slis_layout_alv .
    CONSTANTS : c_len TYPE i VALUE 20 .
    TYPES : BEGIN OF ty_t100          ,
              sprsl TYPE t100-sprsl   ,
              arbgb TYPE t100-arbgb   ,
              msgnr TYPE t100-msgnr   ,
              text  TYPE t100-text    ,
              fline TYPE t100-text    ,
            END OF ty_t100            .
    TYPES : BEGIN OF ty_wrd   ,
             text TYPE char20 ,
            END OF ty_wrd     .
    DATA : it_t100     TYPE TABLE OF ty_t100 ,
           it_sentence TYPE TABLE OF ty_wrd  ,
           wa_t100     TYPE ty_t100          ,
           wa_word     TYPE ty_wrd           ,
           v_repid     TYPE syst-repid       ,
           v_tabix     TYPE syst-tabix       .
    DATA : it_fld TYPE slis_t_fieldcat_alv ,
           it_evt TYPE slis_t_event        ,
           wa_fld TYPE slis_fieldcat_alv   ,
           wa_evt TYPE slis_alv_event      .
    INITIALIZATION .
      v_repid = sy-repid .
    START-OF-SELECTION .
    * Get data
      SELECT *
        INTO TABLE it_t100
        FROM t100
       WHERE sprsl = 'EN'
         AND arbgb = '00' .
      LOOP AT it_t100 INTO wa_t100 .
        v_tabix = sy-tabix .
        CLEAR : it_sentence .
        CALL FUNCTION 'RKD_WORD_WRAP'
             EXPORTING
                  textline  = wa_t100-text
                  outputlen = c_len
             TABLES
                  out_lines = it_sentence.
        IF NOT it_sentence IS INITIAL .
          READ TABLE it_sentence INTO wa_word INDEX 1 .
          wa_t100-fline = wa_word-text .
          MODIFY it_t100 FROM wa_t100 INDEX v_tabix .
        ENDIF.
      ENDLOOP.
    * Prepare fieldcatelog
      CLEAR wa_fld .
      wa_fld-fieldname = 'SPRSL' .
      wa_fld-ref_tabname = 'T100' .
      wa_fld-ref_fieldname = 'SPRSL' .
      APPEND wa_fld TO it_fld .
      CLEAR wa_fld .
      wa_fld-fieldname = 'ARBGB' .
      wa_fld-ref_tabname = 'T100' .
      wa_fld-ref_fieldname = 'ARBGB' .
      APPEND wa_fld TO it_fld .
      CLEAR wa_fld .
      wa_fld-fieldname = 'MSGNR' .
      wa_fld-ref_tabname = 'T100' .
      wa_fld-ref_fieldname = 'MSGNR' .
      APPEND wa_fld TO it_fld .
      CLEAR wa_fld .
      wa_fld-fieldname = 'FLINE' .
      wa_fld-inttype      = 'CHAR' .
      wa_fld-outputlen = 20 .
      wa_fld-intlen    = 20.
      wa_fld-seltext_l = 'Text' .
      wa_fld-ddictxt = 'L' .
      APPEND wa_fld TO it_fld .
    * Get event.. we will handle BOFORE and AFTER line output
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           IMPORTING
                et_events = it_evt.
      READ TABLE it_evt INTO wa_evt
      WITH KEY name = slis_ev_after_line_output .
      wa_evt-form = slis_ev_after_line_output .
      MODIFY it_evt FROM wa_evt INDEX sy-tabix .
      READ TABLE it_evt INTO wa_evt
      WITH KEY name = slis_ev_top_of_page .
      wa_evt-form = slis_ev_top_of_page .
      MODIFY it_evt FROM wa_evt INDEX sy-tabix .
      layout-no_colhead = 'X' .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                i_callback_program = v_repid
                it_fieldcat        = it_fld
                is_layout          = layout
                it_events          = it_evt
           TABLES
                t_outtab           = it_t100.
    *       FORM top_of_page                                              *
    FORM top_of_page .
        uline .
        WRITE: / sy-vline     ,
               10 sy-vline    ,
               11 'line1'     ,
               31 sy-vline    ,
               37 sy-vline    ,
               58 sy-vline    .
        WRITE: / sy-vline     ,
               10 sy-vline    ,
               11 'line2'     ,
               31 sy-vline    ,
               37 sy-vline    ,
               58 sy-vline    .
        WRITE: / sy-vline     ,
               10 sy-vline    ,
               11 'line3'     ,
               31 sy-vline    ,
               37 sy-vline    ,
               58 sy-vline    .
    ENDFORM.
    *       FORM AFTER_LINE_OUTPUT                                        *
    FORM after_line_output   USING rs_lineinfo TYPE slis_lineinfo .
      CLEAR : it_sentence ,
              wa_t100     .
      READ TABLE it_t100 INTO wa_t100 INDEX rs_lineinfo-tabindex .
      CHECK sy-subrc = 0 .
      CALL FUNCTION 'RKD_WORD_WRAP'
           EXPORTING
                textline  = wa_t100-text
                outputlen = c_len
           TABLES
                out_lines = it_sentence.
      DESCRIBE TABLE it_sentence LINES v_tabix .
      CHECK v_tabix > 1 .
      LOOP AT it_sentence INTO wa_word FROM 2 .
        WRITE: / sy-vline     ,
               10 sy-vline    ,
               31 sy-vline    ,
               37 sy-vline    ,
               38 wa_word-text ,
               58 sy-vline .
      ENDLOOP.
    ENDFORM .

  • How to display nodestamp column in ApplicationsTreeTable -ViewMenu- Columns

    I have ApplicationsTree table on my UI screen with the columns ex: col1, col2, col3, col4.
    col1 is inside node stamp.
    col1 is not displaying under View Menu -> Columns.
    How can I display nodestamp column in ViewMenu -> Columns?
    Thanks,
    Swathi

    select a column, then use the contextual menu for the column and select "Add Column Before" or "Add Column After"
    you can also highlight a column then use the key combination:
    <option> + <right arrow> to add a column after (or to the right) and
    <option> + <left arrow> to add a column before (or to the left)

  • How to display dynamic header title in the report?

    I have a req to display dynamic header title in the report.
    When a id is entered in the prompt text, it will display the user data based on that user_id.
    so similarly....the header title should vary each time when you select different user_id.
    How can we implement this?

    >
    Zack H wrote:
    > Lazaro,
    >
    > It depends on what you want displayed in the heading for each id.
    > Please elaborate.
    >
    > Thanks,
    > Zack H.
    Zack..I have several projects listed under several project id's...
    so when a user selects project id 00164 then it should display something like "Project document for Jon Doe"
    again when the user selects project id as 00192 then it should display something like "project document for Zimmerman"
    Did you get it??

  • Display Dynamic Columns in Crystal Report

    Hello,
    We are currently using Crystal Reports XI and connecting to an ADO .NET XML file as our data source. In this data souce we have a data table called IDENTIFIERS where every column, except for the ones used for joining tables is dynamic. These column will be different for each database thats its run against.
    Is there any way to display these dynamic columns without having consistent column names?
    You help is much appreciated.
    Thanks,
    Adam

    Thanks Carl,
    We do have control over the data table and a solution like this had crossed my mind. But this might not be practical for other reports that use this data table.
    I think another solution would be to create a new data tabl that has all identifiers on their own row as opposed to columns.
    id
    dentifier
    identifier_name

  • How to Display 10 columns in first page,next columns in second page in smartforms in sap.

    In internal table having 30 columns of data.
    i have to display like
    first 10 columns in first page with page no :1
    second 10 columns in second page with page no :2
    third 10 columns in second page with page no :3
    how to develop this.
    please how develop this in smartforms .
    please help .

    Hi,
    You dont have to divide the data.
    You must be using TABLE node in your smartform to display the table.
    Copy the node 2 times more so that the total table nodes become 3.
    Now, change the headings in each table according to the column you want to display.
    Change the fields of the workarea in the ITEM lines accordingly.
    Add a COMMAND node after each table and set it to go to next page.
    E.G :
    Suppose I have a table with 6 columns and I need to display 2 columns in a table then page break.
    Work area name is WA.
    Then first table will have headings : FIELD1 FIELD2
    Items will have field     :     WA-FIELD1 WA_FIELD2
    COMMAND NODE : Go to Next Page
    Second table will have heading : FIELD3 FIELD4
    Items will have field     :     WA-FIELD3 WA_FIELD4
    COMMAND NODE : Go to Next Page
    Third table will have heading : FIELD5 FIELD6
    Items will have field     :     WA-FIELD5 WA_FIELD6
    So, same table with same work area will be used 3 times, displaying different set of columns in each TABLE node.
    Regards,
    Ashish

  • Issue in Smartform  "need to display dynamic column or cell"

    HI,
    I need some issue with smart form " ITEM Details"
    matnr maktx menge uom
    i have defined all in the inside table so that i have selected frame ?
    now my issue is i should display only matnr maktx uom
    i don't want display Menge column  if it doesn't have vaule ( in clude cell and box also ).
    i need to display  Menge column  if it  has value .
    how to resolve the issue in smartform?
    replas ASAP.
    Thanks

    Hi,
    Kindly check the below links.. hope this will help you.
    Hide table columns in smart form?
    Hiding column in table in smartform
    Regards,
    Booma Ganesan
    Edited by: booma ganesan on Apr 28, 2010 4:05 PM

  • How to display the column names of a table in the output

    Hi,
    I want to display the name of the columns of the table without using literals in a abap report.
    EX: Consider the table KNA1
    KUNNR NAME  ADDRESS
    I want to display the column names in the above fashion without using hardcoded write statements.
    Thanking in anticipation

    You can use this FM <b>DDIF_FIELDINFO_GET</b> It gives you all the names related to fields in a table -:)
    Greetings,
    Blag.

Maybe you are looking for

  • User defined name in place of application server in SAPGUI 6.40

    Hi, Can anybody please let me know how to define company name in place of static Ip in SAPGUI 6.40. I am using AIX 5.3L / Oracle 9.x / ECC 5.0 I have given static IP in the space provided for application server which I don't want. I want to give comp

  • An iMac G3. All applications + system preferences erased.

    An iMac G3. No FireWire ports. Two USB ports. An ethernet port. Absolutely no applications. Worst of all - no system preferences. Yes, six gigabytes of photographs that are not replaceable. So... I'm wondering what to do... for some reason it does no

  • Multi-valued fields in OIM user profile

    Hi, Does anyone of you have the need and find the solution for multi-valued user profile data in OIM? If so, could you please share your solutions? Thanks, Iris

  • Enabling log using java web start

    Hi all I create my jnlp file including all jsrs of my app. So it loads all the jars starting but it cannot load the main specified in application desc. Actually i cannot see neither a log trace . Where can i find a log trace or where to enable it or

  • Firefox 29 - transparent address bar

    I have just upgraded to Firefox 29 and have managed to change the controls so it looks like the old version but I am unable to work out how to make the address bar and navigation buttons section transparent like they were before. Is there simple way