Dynamic creation of ItemListBox and binding a child node

Hello @all,
I have the following context structure
root
--category
-- --report
-- -- --id
-- -- --name
-- --id
-- --name
the parent node is "category" with attributes "id" and "name" and the child node is "report" with "id" and "name".
Now I want on an onAction-Event of a Button, that for every category an itemListBox will be created with the according report names. the creation of the itemList is not the problem, but the binding of the datasource and/or the descriptivetext.
my code:
public void initItemListBox( )
    //@@begin initItemListBox()
    IWDView view = wdContext.currentContextElement().getSelectView();
    IWDGroup group = (IWDGroup) view.getElement("ItemListGroup");
    if (group.hasChildren())
      group.removeAllChildren();
    for (int i = 0; i < wdContext.nodeCategory().size(); i++)
      ICategoryElement catEl = wdContext.nodeCategory().getCategoryElementAt(i);
      wdContext.nodeCategory().setLeadSelection(i);
      generateItemLists(wdContext.currentContextElement().getSelectView(), wdContext, catEl);
    //@@end
public void generateItemLists( com.sap.tc.webdynpro.progmodel.api.IWDView view, de.mgi.portaldev.bc.mdw.msi.wdp.IPrivateCRSReportView.IContextNode wdContext, de.mgi.portaldev.bc.mdw.msi.wdp.IPrivateCRSReportView.ICategoryElement category )
    //@@begin generateItemLists()
    //    ItemListBox
    IWDGroup group;
    IWDGroup catGroup;
    IWDLabel label;
    String groupId = "group_" + category.getName();
    catGroup = (IWDGroup) view.createElement(IWDGroup.class, groupId);
    IWDMatrixLayout matrLayout = (IWDMatrixLayout) catGroup.createLayout(IWDMatrixLayout.class);
    String labelId = "label_" + category.getName();
    label = (IWDLabel) view.createElement(IWDLabel.class, labelId);
    label.setText(category.getName());
    IWDMatrixData layout = (IWDMatrixData) label.createLayoutData(IWDMatrixData.class);
    layout.setVAlign(WDCellVAlign.TOP);
    String itemListId = "itemList_" + category.getName();
    IWDItemListBox itemListBox = (IWDItemListBox) view.createElement(IWDItemListBox.class, itemListId);
    label.setLabelFor(itemListId);
    IWDMatrixData itemlayout = (IWDMatrixData) itemListBox.createLayoutData(IWDMatrixData.class);
    itemListBox.bindDescriptiveText("crsReporting.category.report.name");
    IWDNodeInfo reportNodeInfo = category.nodeReport().getNodeInfo();
//    itemListBox.bindText(reportNodeInfo.getAttribute("name"));
    itemListBox.setVisibleItems(5);
    IWDMatrixHeadData matrixHead = (IWDMatrixHeadData) itemListBox.createLayoutData(IWDMatrixHeadData.class);
    IWDAction itemListAct = (IWDAction) wdThis.wdGetItemSelectAction();
    itemListBox.setOnLeadSelect(itemListAct);
//    itemListBox.bindDataSource(reportNodeInfo);
    itemListBox.bindDataSource("crsReporting.category.report");
    catGroup.addChild(label);
    catGroup.addChild(itemListBox);
    group = (IWDGroup) view.getElement("ItemListGroup");
    group.addChild(catGroup);
    //    END ITEMLIST
    //@@end
What am I doing wrong? in every ItemListbox there are only the report names of the last category.
thanks.

RowRepeater is available in WD Java since NW CE (7.1). With RowRepeater, the solution is trivial and can be done completely by declaration in view designer.
In earlier releases, you can solve it as follows (non-trivial)
- For each category, create a separate context node "Category_i" with an attribute "name"
- Inside each category node, create a non-singleton node "Reports" with an attribute "name"
- Foreach report, add a node element to the reports subnode of its category node <b>element</b>
All this has to be done using the generic context API.
On each change of the data, reset the context and re-create these nodes.
In wdDoModifyView(), check if data have changes and create UI elements programmatically.
- For each category, create a group, bind header text to category name.
- Inside each group, create a ItemListBox, bind "dataSource" to reports sub-node of category (non-singleton!) and bind "text" to text attribute of report node.
Sample code:
To build context structure:
private void createCategories()
    for (int i = 0; i < 3; ++i)
      IWDNodeInfo categoryNodeInfo = wdContext.getNodeInfo().addChild("Category" + i, null, true, CMICardinality.ONE, CMICardinality.ONE, true, null);
      IWDAttributeInfo att = categoryNodeInfo.addAttribute("name", "ddic:com.sap.dictionary.string");
      IWDNode categoryNode = wdContext.getChildNode(categoryNodeInfo.getName(), 0);
      categoryNode.getElementAt(0).setAttributeValue(att.getName(), "Category #" + i);
      IWDNodeInfo reportNodeInfo = categoryNodeInfo.addChild("Reports", null, false, CMICardinality.MANY, CMICardinality.ZERO_TO_ONE, true, null);
      IWDAttributeInfo attReportName = reportNodeInfo.addAttribute("name", "ddic:com.sap.dictionary.string");
      IWDNode reportNode = categoryNode.getChildNode("Reports", 0);
      for (int j = 0; j < 5; ++j)
        IWDNodeElement report = reportNode.createAndAddElement();
        report.setAttributeValue("name", "Report #" + j);
To recreate UI:
if (<data_have_changed>)
      IWDTransparentContainer root = (IWDTransparentContainer) view.getRootElement();
      for (int i = 0; i < 3; ++i)
        IWDNode categoryNode = wdContext.getChildNode("Category" + i, 0);
        IWDAttributeInfo attName = categoryNode.getNodeInfo().getAttribute("name");
        IWDGroup group = view.createElement(IWDGroup.class);
        root.addChild(group);
        IWDCaption header = view.createElement(IWDCaption.class);
        group.setHeader(header);
        header.bindText(attName);
        IWDNode reportsNode = categoryNode.getChildNode("Reports", 0);
        IWDAttributeInfo attReportName = reportsNode.getNodeInfo().getAttribute("name");
        IWDItemListBox list = view.createElement(IWDItemListBox.class);
        group.addChild(list);
        list.bindDataSource(reportsNode.getNodeInfo());
        list.bindText(attReportName);
Armin
Fixed code tags

Similar Messages

  • Non-reproducable issue dynamic domain based dropdownlist and bind parameter

    [JDeveloper 10.1.3. SU5]
    [JHeadstart 10.1.3. build 91]
    Hi,
    Some dropdown lists in our application, which are based on a dynamic dropdown list using a bind parameter (value for the parameter set in Application Definition File, property 'Query Bind Parameters', i.e. theCodeType=LANGUAGE) most of the time work fine, but sometimes (not structural, not reproducable) do not fill and throw the error "Missing IN or OUT parameter at index: 1".
    This is the case for example in LOV's with Advanced search: one of these advanced search fields uses such a dropdown. When entering the LOV, the error is sometimes raised (and the dropdown list is empty), but when you cancel and try again, it always fills successfully without error. So the mechanism works almost always, but in rare cases gives this error, but not always...and a retry always works as well.
    Sounds like a known error?
    Toine

    I have run into a similar issue recently, using Jdeveloper 10.1.3.1.0 (currently the latest release)
    It's intermittent and next to impossible to repeat. Here's the debug-output:
    ...sql query) QRSLT WHERE SOMEID = :Bind_Someid
    06/12/11 15:12:37 [7494] Bind params for ViewObject: SomeView2
    06/12/11 15:12:37 [7495] Binding param "Bind_Someid": 212
    06/12/11 15:12:37 [7496] ViewObject: SomeView2 close single-use prepared statements
    06/12/11 15:12:38 [7497] QueryCollection.executeQuery failed...
    06/12/11 15:12:38 [7498] java.sql.SQLException: Missing IN or OUT parameter at index:: 1
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175)
         at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1566)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2996)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3043)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:857)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:687)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2657)
         at oracle.jbo.server.ViewRowSetIteratorImpl.refresh(ViewRowSetIteratorImpl.java:2915)
         at oracle.jbo.server.ViewRowSetImpl.notifyRefresh(ViewRowSetImpl.java:2085)
         at oracle.jbo.server.ViewRowSetImpl.refreshRowSet(ViewRowSetImpl.java:4839)
         at oracle.jbo.server.ViewRowSetIteratorImpl.notifyDetailRowSets(ViewRowSetIteratorImpl.java:3408)
         at oracle.jbo.server.ViewRowSetIteratorImpl.notifyNavigationToRow(ViewRowSetIteratorImpl.java:3549)
         at oracle.jbo.server.ViewRowSetIteratorImpl.notifyNavigation(ViewRowSetIteratorImpl.java:3509)
         at oracle.jbo.server.ViewRowSetIteratorImpl.internalSetCurrentRow(ViewRowSetIteratorImpl.java:3293)
         at oracle.jbo.server.ViewRowSetIteratorImpl.setCurrentRow(ViewRowSetIteratorImpl.java:1000)
         at oracle.jbo.server.ViewRowSetIteratorImpl.activateIteratorState(ViewRowSetIteratorImpl.java:3851)
         at oracle.jbo.server.ViewRowSetIteratorImpl.getRangeSize(ViewRowSetIteratorImpl.java:627)
         at oracle.jbo.server.ViewRowSetImpl.getRangeSize(ViewRowSetImpl.java:2251)
         at oracle.jbo.server.ViewObjectImpl.getRangeSize(ViewObjectImpl.java:6090)
         at oracle.adf.model.binding.DCIteratorBinding.initSourceRSI(DCIteratorBinding.java:1550)
         at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1421)
         at oracle.adf.model.binding.DCIteratorBinding.getRowSetIterator(DCIteratorBinding.java:1404)
         at oracle.adf.model.binding.DCIteratorBinding.setRangeSize(DCIteratorBinding.java:2642)
         at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:2487)
         at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2260)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareModel(PageLifecycleImpl.java:99)
         at oracle.adf.controller.faces.lifecycle.FacesPageLifecycle.prepareModel(FacesPageLifecycle.java:73)
         at oracle.adf.controller.v2.lifecycle.Lifecycle$8.execute(Lifecycle.java:210)
         at oracle.adf.controller.v2.lifecycle.Lifecycle.executePhase(Lifecycle.java:116)
         at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.mav$executePhase(ADFPhaseListener.java:33)
         at oracle.adf.controller.faces.lifecycle.ADFPhaseListener$4.after(ADFPhaseListener.java:331)
         at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:94)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:254)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:231)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:200)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:122)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:106)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:619)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Once the problem occurs, it is persistent and is not resolved except by logging the user out (session.invalidate()) or starting a new session.
    Is there anything I can do to resolve this?

  • Dynamic Creation of Buttons and Actions HELP

    Hi there,
    I have got a problem (or maybe even two) with the dynamic Creation of buttons. The code below creates the buttons.
    My main problem is, that the parameter created for the button's action isn't propagated to the assigned event handler. I get a null, though the name of the parameter in the event handler and the name of the parameter added to the action are the same.
    Could it also be that I'm always using the same action? I.e. does wdThis.wdGetAddElementAction() always return the same action instance? If yes, how can I create individual actions for each button?
    Any help is appreciated!
    Cheers,
    Heiko
    "    for(int i=rootContainer.getChildren().length; i<wdContext.nodeFeature().size();i++)
                   IPrivateVCT_Feature.IFeatureElement featureElement = wdContext.nodeFeature().getFeatureElementAt(i);
                   IWDTray featureTray = (IWDTray) view.createElement(IWDTray.class, featureElement.getName());
                   IWDCaption header = (IWDCaption) view.createElement(IWDCaption.class, featureElement.getName()+"_Header");
                   header.setText(featureElement.getName());
                   featureTray.setHeader(header);
                   featureTray.setExpanded(false);
                   rootContainer.addChild(featureTray);
                   IWDButton button = (IWDButton) view.createElement(IWDButton.class, featureElement.getName()+"_Button_AddElement");
                   IWDAction actionAddElement = wdThis.wdGetAddElementAction();
                   actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
                   button.setOnAction(actionAddElement);
                   button.setText("Add Element");
                   featureTray.addChild(button);

    Hi Heiko,
    You have done everything correctly....except for 1 line
    in the code...
    Replace the following line in your code:
    actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
    Replace the above line with this code:
    button.mappingOfOnAction().addParameter("featureIndex",i);
    Actually in your code, you are not associating the parameter with the button...
    Note that addParameter(...) comes with two signatures: addParameter(String param, String value) and addParameter(String param, int value). You can use any of them based on yuor need.
    Hope it helps,
    Thanks and Regards,
    Vishnu Prasad Hegde

  • Create dynamic table at runtime and bind it with ViewObject

    Hi everyone.
    I have the following task.
    I need to create a multiple ViewObjects at runtime (using different constructed sql queries) and then bind ViewObjects with created (also in runtime) tables.
    Tables are to be created on PanelTabbed component. Each tab contains one table.
    So the problem - is there a way to perform this task?
    A portion of code:
    ApplicationModule am = ADFUtils.getApplicationModule("AppModule");
    ViewObjectImpl vo = null;
    if (am.findViewObject("SQLVo") != null)
    am.findViewObject("SQLVo").remove();
    System.out.println("object removed!");
    vo = am.createViewObjectFromQueryStmt("vo", "select ...");
    RichTable newTable = new RichTable();
    newTable.setVar("row");
    newTable.setVarStatus("rowStat");
    RichShowDetailItem newDetItem = new RichShowDetailItem();
    newDetItem.setText("New Detail");
    newTable.setInlineStyle("width:100%;height:180px");
    newTable.setRowSelection("single");
    DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    String iterBindingName = vo.getName() + "Iterator";
    JUIteratorBinding iterBinding =
    (JUIteratorBinding)dcBindings.findIteratorBinding(iterBindingName);
    if (iterBinding != null) {
    dcBindings.removeIteratorBinding(iterBindingName);
    BindingContext bcc = (BindingContext)JSFUtils.resolveExpression("#{data}");
    iterBinding =
    new JUIteratorBinding(bcc.findDataControl("AppModuleDataControl"), vo);
    String ctrlBindingName = vo.getName() + "Binding";
    FacesCtrlHierBinding clonedHierBinding =
    (FacesCtrlHierBinding)dcBindings.findCtrlBinding(ctrlBindingName);
    if (clonedHierBinding != null) {
    dcBindings.removeControlBinding(ctrlBindingName);
    =======================================
    Please, look here!
    What's the best practices to create a new FacesCtrlHierBinding?
    What a parameter _nodeBindings (type JUCtrlHierTypeBinding[]) should be?
    =======================================
    clonedHierBinding =
    new FacesCtrlHierBinding(null,
    iterBinding,
    new String[]{
    "BUILDING_ID"
    // "BUILD_NAME",
    // "FUNCTIONALITY_NAME",
    // "CITY_NAME",
    // "STREET_NAME",
    // "FLOORS"
    _nodeBindings
    dcBindings.addControlBinding(ctrlBindingName, clonedHierBinding);
    newTable.setValue(clonedHierBinding.getCollectionModel());
    for (int g=0; g < vo.getAttributeCount(); g++){
    RichColumn col = new RichColumn();
    col.setId("c" + Integer.toString(g));
    col.setHeaderText(vo.getAttributeDef(g).getProperty(AttributeHints.ATTRIBUTE_LABEL).toString());
    ValueExpression valExp =
    facesContext.getApplication().getExpressionFactory().createValueExpression(facesContext.getELContext(),
    "#{row." + vo.getAttributeDef(g).getName() + "}",String.class);
    RichOutputText text = new RichOutputText();
    text.setId(vo.getAttributeDef(g).getName() + "txt");
    text.setValueExpression("value", valExp);
    col.getChildren().add(text);
    newTable.getChildren().add(col);
    newDetItem.getChildren().add(newTable);
    myBean.panelTabbed.getChildren().add(newDetItem);
    ...

    Shay, good day!
    You answer is good, but - it use only one dynamic view (and one table, iterator and FacesModel).
    I have task like topic started have - i need to create some unknows numbers of ViewObject (created by demad) and i must have a FacesModel for each created ViewObject.
    How can we do it?

  • Dynamic creation of variables and alv grid output/internal table

    Dear Experts
    I am stuck in an inventory ageing report which is to be done year wise. the scenario is as follow.
    selection screen i enter the year 2011 or 2010 or 2009.
    the output should show me 2011-2007 or 2010-2007 or 2009-2007. the alv grid should always start from 2007 and end at the year that is entered in the selection screen.
    Now how can i create a dynamic variables to store the values of the corresponding yr and also how can i create a dynamic internal table to store these values.
    Thanks & Regards
    Zamir Parkar

    Hi Zamir,
    if you are new to ABAP you may leave old and buggy techniques behind.
    If you want to create the table dynamically, please do not use l_alv_table_create=>create_dynamic_table because it is limited and always triggers a possibly unwanted database commit.
    You better use RTTS dynamic runtime type services, i.e. check the example for [Creating Flat and Complex Internal Tables Dynamically using RTTI|http://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI].
    As done here, leave all outdated ALV technologies behind and start with CL_SALV_TABLE. It is following the object-oriented approach and does not need a field catalog.
    You will get used to field-symbols that can be compared to the data referenced by a pointer. For dynamic fields, you may build the field names dynamically, i.e.
    DATA:
          lo_structdescr         TYPE REF TO cl_abap_structdescr,
          lo_typedescr           TYPE REF TO cl_abap_typedescr,
          lo_tabledescr          TYPE REF TO cl_abap_tabledescr,
          lr_data                TYPE REF TO data,
          lt_comp_all            TYPE cl_abap_structdescr=>component_table,
          lv_index               TYPE numc2.
        FIELD-SYMBOLS:
          <any>                  TYPE ANY,
          <component>            TYPE LINE OF abap_component_tab,
           <table>                TYPE table.
        DO nnn TIMES.
          lv_index = sy-index.
          lo_typedescr   =  cl_abap_typedescr=>describe_by_name( <name of data element> ).
          APPEND INITIAL LINE TO lt_comp_all ASSIGNING <component>.
          <component>-type ?= lo_typedescr.
          CONCATENATE 'YEARVAL' lc_underscore lv_index INTO <component>-name.
          <component>-as_include  = abap_true.
          CONCATENATE lc_underscore lv_index INTO <component>-suffix.
        ENDDO.
    * create description object for structured type
        lo_structdescr = cl_abap_structdescr=>create( lt_comp_all ).
    *  create table description object for this
        lo_tabledescr = cl_abap_tabledescr=>create(
                        p_line_type  = lo_structdescr
                        p_table_kind = cl_abap_tabledescr=>tablekind_std
                        p_unique     = abap_false ).
    * create data object
        CREATE DATA lr_data TYPE HANDLE lo_tabledescr.
    ASSIGN lr_data->* to <table>.
    This is a fragment. Please adapt to your needs.
    Regards,
    Clemens

  • Dynamic creation of tables and data insertion in BODS

    Specific requirement : We need to extract multiple tables from ERP system and stage them in BODS SQL server database.
    As the need is for lot of tables , we want to come up with a generic Job which can be used for all the tables which have different sructures.
    So BODS Job should create tables on the fly and also load data into different tables not having same structure. We can maintain a config table of all the tables to be extracted.
    Any ideas?

    Dirk,
    The job should be generic to cater to n number of tables , we are looking at one job where the source /Target structures are not imported so that it becomes generic and we don't know the count of tables that we will be extracting . We just like one job , which can extract tables as and when we add table names in the config table.......

  • Dynamic creation of class and calling methods

    I've got and interface called Transformation and then two implementations called TxA and TxB, where TxA and TxB have their own attribtues and setter and getters for these attributes.
    The question is, I need to create instances of TxA and TxB and called the setter and getters where I at runtime I only know the attribute to set, how can I create and instance and call the right getters and setters methods?
    Thanks in advance

    Smart money says your design sucks and needs to be rethought entirely. Can we get specifics?
    Drake

  • Dynamic Creation of Table and assign Datasource.

    Hi Experts
    My scenario is like this..
    There are more than one RFC models and the output list of these models I need to display in a table format.. The display should happen conditionally as per the availabity of the data in the output list..I need to display the data from multiple models at the same time the said table..
    Please let me know the methods to create a table with 5 columns and also how to assign the datasource programatically..
    THanks and Regards
    SU

    Hi,
    Use only one Table View context.
    Model Contexts:
    RFC1,           RFC2,            RFC3
    I_Attr11         I_Attr21          I_Attr31
    I_Attr12         I_Attr22          I_Attr32
    I_Attr13         I_Attr23          I_Attr33
    I_Attr14         I_Attr24          I_Attr34
    I_Attr15         I_Attr25          I_Attr35
    Table Control Context:
    Table
    I_Attr1
    I_Attr2
    I_Attr3
    I_Attr4
    I_Attr5
    Execute each model individually and loop through all model contexts...append the rows from each model context to table context.
    //access the table node
    IWDTableNode tableNode = wdContext.nodeTable();
    IWDTableElement tableElem;
    //loop thugh the models
    for(int i=0; i<RFC1.size(); i++)
    tableElem = tableNode.createTableElement();
    tableElem.setAttr1(RFC1.getRFC1ElementAt(i).getAttr11);
    tableElem.setAttr2(RFC1.getRFC1ElementAt(i).getAttr12);
    tableElem.setAttr3(RFC1.getRFC1ElementAt(i).getAttr13);
    tableElem.setAttr4(RFC1.getRFC1ElementAt(i).getAttr14);
    tableElem.setAttr5(RFC1.getRFC1ElementAt(i).getAttr15);
    tableNode.addElement(tableElem);
    //similarly loop thrugh the remaining 2 models and append the table context
    Regards
    Srikanth

  • How to read XML and parse all child nodes

    Here is a sample of my XML file and I want to be able to put into a grid the Server Name, User ID, Password, and then list under all Databases associated with that server.
    <Servers>
      <Server>
        <Name>PROD_Server</Name>
        <Database>CUSTOMER</Database>
        <Database>LOCATION</Database>
        <Database>ORDERS</Database>
        <Database>RETURNS</Database>
        <UserID>RSMITH></UserID>
        <Password>$EWRaZ</Password>
       </Server>
       <Server>
        <Name>WEST_Server</Name>
        <Database>OPTIONS</Database>
        <Database>PRICES</Database>
        <UserID>THAMPTON></UserID>
        <Password>$EWRyAQ</Password>
       </Server>
       <Server>
        <Name>PASS_PLUS</Name>
        <Database>AUTOMOBILES</Database>
        <Database>VINNUMBERS</Database>
        <Database>OWNERS</Database>
        <UserID>BHARVEY></UserID>
        <Password>$VRRaZ</Password>
       </Server>
    </Servers>
    How can I do this?  

    Hello,
    Using the xml you supplied I see a master-detail relationship going on which is best shown in at least two DataGridView controls or the master table hooked up to a BindingSourceNavigator then child rows for Database in a DataGridview or label or TextBox
    controls.
    The code below loads the xml data into a DataSet then uses two BindingSource components to create a master-detail setup that can be setup say in Form load event
    Dim ds As New DataSet
    ds.ReadXml(IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLFile1.xml"))
    Master.DataSource = ds
    Master.DataMember = ds.Tables(0).TableName
    Details.DataSource = Master
    Details.DataMember = ds.Relations(0).RelationName
    DataGridView1.DataSource = Master
    DataGridView2.DataSource = Details
    Declare the BindingSource components at form level
    Private Master As New BindingSource
    Private Details As New BindingSource
    Screenshot using two DataGridView controls.
    I would suggest the above as other methods to place all columns into a DataGridView is problematic.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile
    but do not reply to forum questions.

  • How To Display  attributes of Child Node and Parent Node in same view

    Suppose I have two view Carview and CarDetail View...IN Component context I have Parent Node Called Cars and It have its attribute as Price,Warranty,Year and also One Child Node Called as Brand Name Whose attribute are PrimaryBrand and SecondaryBrand..Now If I do Mapping of My First View i.e CarView with Child node of BrandName..and then I Have To Show Whole Detail of Car in CarDetailView.......How Can I Achieve it..

    Hi Vinay,
    You can map the child node and even the paren tnode to the same view if u want to display in the same window..
    If not if ur requirment is to dispaly in the sme view but should not map the child and parent to the Same view then you can take another new view.. and insert 2 view containers and then add the Child view and parent view in that view containers and then Diaplay the newly created view.
    Regards,
    Raju Bonagiri

  • Need to chart attribute value of just one child node of XML document

    I have a XML document with (for example) 7 parent nodes, each
    parent node has 5 child nodes. The parent nodes have an attribute
    @EarlierDTS (DateTime type) that is the x-axis category of a chart.
    Each child node has an attribute @eventid which specifies the id of
    the event, and another atttribute @NumOccurs which specifies how
    many times that event occured in that period.
    How do I tell Flex I want a simple line chart of the eventID
    = 215? What if I want two lines, for both eventID=215 and
    eventid=307?
    I have studied the posts and blogs for over a week now, and
    have seen this question or similar come up quite a few places, with
    no answer.
    1) Should I focus on learning how to create a filterfunction
    for the XMLList that underlies my XMLListCollection so that the
    filtered data view is just one child node per parent node ( or two
    child nodes for the second case)? And set the filtered data view as
    the dataprovider of my chart's vertical series?
    2) Should I focus on learning how to create a XML Filter
    query that selects just one or two child nodes for each parent
    node, and set the charts' series' dataprovider to this filter
    expression? (I don't think this is allowed - but I'm checking with
    the forum members...)
    3) Should I focus on learning how to convert the
    XMLListCollection into a HierarchicalData object, and then learning
    how to filter this object so there is only one (or two) childs per
    parent? This seems like a lot of coding - I almost have to create a
    pair of classes - one for the parent and one for the child - so I
    can create nested ArrayObjects.
    4) Should I create a brand new XMLList by walking the
    original XML list, and inserting Parent nodes and just the child
    nodes that match the eventID(s) I want to chart, into the new
    XMLList?
    I believe that the easiest way would be to create a
    Filterfunction for the XMLList, and bind the chart series to the
    (filtered) XML List. But the problem with this approach is that I
    have seen more than 2 posts asking how to accomplish filtering that
    removes specific children from the view, with no solutions posted.
    Help! What is the best way to get just one child for each
    parent, from an XMLList?

    "whertzing" <[email protected]> wrote in
    message
    news:[email protected]...
    >I have a XML document with (for example) 7 parent nodes,
    each parent node
    >has 5
    > child nodes. The parent nodes have an attribute
    @EarlierDTS (DateTime
    > type)
    > that is the x-axis category of a chart. Each child node
    has an attribute
    > @eventid which specifies the id of the event, and
    another atttribute
    > @NumOccurs
    > which specifies how many times that event occured in
    that period.
    >
    > How do I tell Flex I want a simple line chart of the
    eventID = 215? What
    > if I
    > want two lines, for both eventID=215 and eventid=307?
    >
    > I have studied the posts and blogs for over a week now,
    and have seen this
    > question or similar come up quite a few places, with no
    answer.
    >
    > 1) Should I focus on learning how to create a
    filterfunction for the
    > XMLList
    > that underlies my XMLListCollection so that the filtered
    data view is just
    > one
    > child node per parent node ( or two child nodes for the
    second case)? And
    > set
    > the filtered data view as the dataprovider of my chart's
    vertical series?
    >
    > 2) Should I focus on learning how to create a XML Filter
    query that
    > selects
    > just one or two child nodes for each parent node, and
    set the charts'
    > series'
    > dataprovider to this filter expression? (I don't think
    this is allowed -
    > but
    > I'm checking with the forum members...)
    >
    > 3) Should I focus on learning how to convert the
    XMLListCollection into a
    > HierarchicalData object, and then learning how to filter
    this object so
    > there
    > is only one (or two) childs per parent? This seems like
    a lot of coding -
    > I
    > almost have to create a pair of classes - one for the
    parent and one for
    > the
    > child - so I can create nested ArrayObjects.
    >
    > 4) Should I create a brand new XMLList by walking the
    original XML list,
    > and
    > inserting Parent nodes and just the child nodes that
    match the eventID(s)
    > I
    > want to chart, into the new XMLList?
    >
    > I believe that the easiest way would be to create a
    Filterfunction for the
    > XMLList, and bind the chart series to the (filtered) XML
    List. But the
    > problem
    > with this approach is that I have seen more than 2 posts
    asking how to
    > accomplish filtering that removes specific children from
    the view, with no
    > solutions posted.
    >
    > Help! What is the best way to get just one child for
    each parent, from an
    > XMLList?
    I'd just look at a dataFunction. There's an example here that
    may point you
    in the right direction:
    http://flexdiary.blogspot.com/2008/08/charting-example.html
    HTH;
    Amy

  • Dynamic creation of context nodes and ui elements

    Hi,
    I have created context nodes dynamically. And i also want to create UI elements dynamically wherein i want to bind the attribute from the context node to it. For example i want to create a drop down by index and bind one of the attributes in the context nodes that i have earlier created dynamically to it.  I do not know how to get the path to the attribute as i get IF_WD_CONTEXTNODE_INFO when i say get_child_node(). And the IF_WD_CONTEXTNODE_INFO does not have any method where in i can get IF_WD_CONTEXT_NODE from where i can get the path by get_meta_path( )
    Here is the code. The problem is to get the path which is the i/p to cl_wd_dropdown_by_idx=>new_dropdown_by_idx( ) method.
    DATA:
            lo_root_ui_elmnt              TYPE REF TO cl_wd_uielement_container,
            lo_drpdwn_by_idx              TYPE REF TO cl_wd_dropdown_by_idx,
            lo_txt_vw                     TYPE REF TO cl_wd_text_view,
            lo_qstn_node                  TYPE REF TO if_wd_context_node,
            lo_optn_node_info             TYPE REF TO if_wd_context_node_info,
            lv_optn_data_source_name      TYPE string,
            lt_child_nodes                TYPE wdr_context_child_map,
            lo_qstn_el                    TYPE REF TO if_wd_context_element,
            lo_optn_el                    TYPE REF TO if_wd_context_element,
            lv_text                       TYPE string,
            lo_qstn_node_info             TYPE REF TO if_wd_context_node_info.
      FIELD-SYMBOLS:
    *                 <ls_qstn>    LIKE LINE OF wd_this->mt_questions.
                    <ls_child_node>         LIKE LINE OF lt_child_nodes.
      lo_root_ui_elmnt ?= io_view->get_root_element( ).
      lt_child_nodes = wd_context->get_child_nodes( ).
    LOOP AT lt_child_nodes ASSIGNING <ls_child_node>.
       lo_qstn_node = <ls_child_node>-node.
        lo_qstn_el = lo_qstn_node->get_element( index = 1 ).
        lo_qstn_el->get_attribute(
              EXPORTING
                name = 'QUESTION_TEXT'
               IMPORTING
                 value = lv_text ).
        lo_txt_vw =   cl_wd_text_view=>new_text_view( view = io_view ).
        lo_txt_vw->set_text( value = lv_text  ).
        lo_qstn_node_info = lo_qstn_node->get_node_info( ).
        lo_optn_node_info = lo_qstn_node_info->get_child_node( 'OPTIONS' ).
    *    lv_optn_data_source_name = lo_optn_node_info->get_meta_path( withoutcontroller = abap_true ).
    *    CONCATENATE lv_optn_data_source_name '.' 'OPTION_TEXT' INTO lv_optn_data_source_name.
        lo_drpdwn_by_idx = cl_wd_dropdown_by_idx=>new_dropdown_by_idx(
                              bind_texts = lv_optn_data_source_name
                              view       = io_view ).
        lo_root_ui_elmnt->add_child( lo_txt_vw ).
        lo_root_ui_elmnt->add_child( lo_drpdwn_by_idx ).
      ENDLOOP.
    Regards,
    Madhura Lobo
    Edited by: Suhas Saha on Aug 2, 2011 11:04 AM

    Hi Madhura,
    Please check this thread and find Baskaran answer...
    create new child-node in supply-function
    Re: Creating Dynamic Node and Table
    Cheers,
    Kris.

  • Binding Dropdownbykey to child node's attribute dynamically

    Hi..
    i am creating a child node "CHILD" and attribute attached to it "ATTR" dynamically. Also i create a dynamic dropdownbykey element and trying to attach the ATTR. then i get the following error. zdyn_date is data element with some fixed values. Please let me know as quick as possible.
    <b>"Adapter error in DROPDOWN_BY_KEY "KEY1" of view "ZDYN_DDKEY.MAIN": Context binding for property SELECTED_KEY cannot be resolved: The MAIN.1.CHILD node does not contain any elements"</b>
    METHOD WDDOMODIFYVIEW .
      DATA: LR_ROOT_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO,
            LR_CHILD_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO,
            cl_des type REF TO CL_ABAP_ELEMDESCR,
    ATTR_INFO TYPE WDR_CONTEXT_ATTRIBUTE_INFO.
      LR_ROOT_INFO = WD_CONTEXT->GET_NODE_INFO( ).
    CALL METHOD lr_root_info->ADD_NEW_CHILD_NODE
          EXPORTING
            NAME                         = 'CHILD'
          RECEIVING
            CHILD_NODE_INFO              = lr_child_info.
      ATTR_INFO-NAME = 'ATTR'.
      ATTR_INFO-TYPE_NAME = 'ZDYN_DATE'.
      CALL METHOD lr_child_info->ADD_ATTRIBUTE
        EXPORTING
          ATTRIBUTE_INFO = ATTR_INFO.
      DATA: LR_ROOT_CONTAINER TYPE REF TO CL_WD_TRANSPARENT_CONTAINER,
            LE_DD_KEY1 TYPE REF TO CL_WD_DROPDOWN_BY_KEY.
      LR_ROOT_CONTAINER ?= VIEW->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER' ).
      CALL METHOD CL_WD_DROPDOWN_BY_KEY=>NEW_DROPDOWN_BY_KEY
        EXPORTING
          BIND_SELECTED_KEY      = 'CHILD.ATTR'
          ID                     = 'KEY1'
        RECEIVING
          CONTROL                = LE_DD_KEY1. .
      CALL METHOD CL_WD_MATRIX_LAYOUT=>NEW_MATRIX_LAYOUT
        EXPORTING
          CONTAINER = LR_ROOT_CONTAINER.
      CALL METHOD CL_WD_MATRIX_HEAD_DATA=>NEW_MATRIX_HEAD_DATA
        EXPORTING
          ELEMENT = LE_DD_KEY1.
      CALL METHOD LR_ROOT_CONTAINER->ADD_CHILD
        EXPORTING
        INDEX     =
          THE_CHILD = LE_DD_KEY1.
    ENDMETHOD.

    Hi ,
    can u try to create the node and its attribute in some other method..like in some action or in WDDOINIT instead of wddomodifyview .bcoz its recommended not to modify the data of node in wddomodifyview ..
    hope it will solve ur problem .
    Regards
    Yash

  • Dynamic sql and bind variables

    Hi,
    I have a stored procedure which filters a table on 5 five columns. The filters come from the input parameters,
    and these 5 parameters can come in any combination, I mean some of them may be null and some of them may not be null.
    So I constructed the where filter of the query with IF blocks like the following:
    dynamic_query := 'select * from TESTTABLE where 1= 1';
    IF (P1 is not null) THEN
    dynamic_query := dynamic_query || ' AND column1 = :1';
    END IF;
    IF (P2 is not null) THEN
    dynamic_query := dynamic_query || ' AND column2 = :2';
    END IF;
    IF (P3 is not null) THEN
    dynamic_query := dynamic_query || ' AND column3 = :3';
    END IF;
    IF (P4 is not null) THEN
    dynamic_query := dynamic_query || ' AND column4 = :4';
    END IF;
    IF (P5 is not null) THEN
    dynamic_query := dynamic_query || ' AND column5 = :5';
    END IF;
    OPEN CUR_OUT FOR dynamic_query USING P1, P2, P3, P4, P5;
    The problem is how can I construct the USING and bind parameters, I cannot use "USING P1, P2, P3, P4, P5" because some of bind variables
    may not be in dynamic query if the input parameters are null. Is there a way to overcome this problem without writing all the 2 ^ 5 combinations?
    Any help is greatly appreciated.

    here it is in the Tomer Cohen way:
    IF (P1 is not null) THEN
    dynamic_query := dynamic_query || ' AND column1 = :1';
    ELSE
    dynamic_query := dynamic_query || ' AND  :1 IS NULL';
    END IF;
    IF (P2 is not null) THEN
    dynamic_query := dynamic_query || ' AND column2 = :2';
    ELSE
    dynamic_query := dynamic_query || ' AND  :2 IS NULL';
    END IF;
    IF (P3 is not null) THEN
    dynamic_query := dynamic_query || ' AND column3 = :3';
    ELSE
    dynamic_query := dynamic_query || ' AND  :3 IS NULL';
    END IF;
    IF (P4 is not null) THEN
    dynamic_query := dynamic_query || ' AND column4 = :4';
    ELSE
    dynamic_query := dynamic_query || ' AND  :4 IS NULL';
    END IF;
    IF (P5 is not null) THEN
    dynamic_query := dynamic_query || ' AND column5 = :5';
    ELSE
    dynamic_query := dynamic_query || ' AND -1 = :5';
    END IF;
    OPEN CUR_OUT FOR dynamic_query USING P1, P2, P3, P4, P5;Amiel Davis

  • Creating and Binding View Objects dynamically : Oracle Jdeveloper 11g

    Hello,
    We are trying to create and bind view objects dynamically to adf data visualization components.
    The view object is a result of multiple tables.
    We are using Oracle JDeveloper 11g Technical Preview. ( can't upgrade to TP2 or TP3 now).
    We have found this : http://radio.weblogs.com/0118231/stories/2003/07/15/creatingUpdateableMultientityViewObjectDefinitionsDynamically.html on our search for the same.
    The sample application however, is in 10g , hence required migration.
    Also, it was a standalone application with the TestClient.java having a main() method.
    Our requirement is for Web Application; we use Adf+jsf .
    Guidance of any sort is very much appreciated.
    Thanks in advance.
    -Anil Golla

    Hi,
    there also exist a forum for JDeveloper 11: JDeveloper and OC4J 11g Technology Preview
    What you are trying todo is not trivial because you need to not only dynamically create the VO, you would also dynamically need to create the binding meta data for it (assuming you use ADF). Not sure if the API to modify the binding is public, so posting it on the JDeveloper 11 forum bears a glimpse of hope for an answer
    In JDeveloper 10.1.3 you can't do this
    Frank

Maybe you are looking for

  • ITunes downloads but won't open

    Ever since I upgraded to iTunes 7 in September, I've been having problems...it worked great for the first week and now refuses to open. I've tried completely removing iTunes, Quicktime, and iPod Updater before reinstalling, but it still won't work af

  • Any tutorials on how to use the daily build of the Flex SDK to create Flash Player 10 content?

    Is there a tutorial on Adobe on how to use the daily build of the Flex SDK to create Flash Player 10 content?

  • LCM Error

    Hyperon Essbase/Planning 11.1.2 When I attempt to LCM a file to a new application I get the following error - what causes this? Cannot retrieve migration status for importArtifact(s). Nested exception is [MESSAGE - org.xml.sax. SAXParseException: XML

  • BATCH INPUT TO CHECK AUTHORIZATION

    Hi All, Can anyone tell me how to code a small batch that will go into sap to ensure system authorizations are set?As the requirement is immediate,quick answers will be highly appreciated. Rewards if useful. Thanks n Regards, Indu.

  • Connecting to database code

    I'm looking for some code that will connect to a MS-SQL DB ( or any other DB ), query it and work with a result set. It doesn't have to be too specific in what it does, I'm just looking for some generic code that I can learn from. Thanks,