8 Replies Latest reply: May 13, 2012 6:00 AM by Sudipto Desmukh RSS

    getting certain column's data of slected row from table

    931841
      Hi all;
      I need to get certain column's data of selected row from table ....
      How can i get it done...
      Can you help on this matter please
        • 1. Re: getting certain column's data of slected row from table
          Sudipto Desmukh
          http://www.johnbrunswick.com/2011/08/adftable-get-selected-row-or-rows/
          Columns will represent attributes from the currentRow of the iterator
          • 2. Re: getting certain column's data of slected row from table
            umesh.agarwal
            http://www.oracle.com/technetwork/developer-tools/adf/learnmore/july2011-otn-harvest-444848.pdf
            See Page#9. Hope it helps.
            • 3. Re: getting certain column's data of slected row from table
              Timo Hahn
              Your question lack some vital information.
              Which jdev version?
              Which ui technology?

              Where do you need the information (bean, UI, model)?

              Simplest way to archive this is generate bindings for the columns attributes you need (which are automatically bound to the current selected row). This you can archive if you drag the VO onto the page and drop it as ADF Form. Remove all not needed attributes and let the framework generate the form (even you don't want it). This will generate the needed attribute bindings. Now you switch to source mode and remove the whole af:panelForm including all attributes. Doing this in source mode will leave the bindings. Now, if you select a row in your table the attributes of this row are mappted into the generated attribute bindings. These you can use like all other attribute bindings.

              Timo
              • 4. Re: getting certain column's data of slected row from table
                872870
                Hello,

                can you check following code works?

                public void onTableSelect(SelectionEvent selectionEvent) {
                Row selRow = null;
                selRow =
                JSFUtils.selectedRowFromTable(t1, "YourTableVO1Iterator");
                String Column1 = ((String)selRow .getAttribute("Column1"));

                }
                • 5. Re: getting certain column's data of slected row from table
                  931841
                  Thank you guys for hellping me on this matter....
                  For Those who re still wondering about same problem;

                  XXXAppModuleImpl am =
                  XXXAppModuleImpl)oracle.jbo.client.Configuration.createRootApplicationModule("xx.yy.ssl.XXXAppModule",
                  "XXXAppModuleLocal");
                  ViewObjectImpl vo = am.getXXXView1();
                  Row row = vo.createRow();
                  DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
                  DCIteratorBinding dcIteratorBindings = bindings.findIteratorBinding("xxxIterator");
                  ViewObject hbView = dcIteratorBindings.getViewObject();
                  Row selectedRow = hbView.getCurrentRow();
                  row.setAttribute("Name", selectedRow.getAttribute("name"));
                  row.setAttribute("Surname", selectedRow.getAttribute("surname"));
                  row.setAttribute("BirthDate", selectedRow.getAttribute("birthdate"));
                  vo.insertRow(row);
                  • 6. Re: getting certain column's data of slected row from table
                    Timo Hahn
                    User,
                    your 'solution' may look as if it works, but you'll see (at least if you deploy it to a production server) that it breaks the whole server.

                    I can only warn you and any other user reading this thread to use this code.

                    The link umesh.agarwal supplied in his post is the way to go. It uses the technique I outlined in my post, only you create the attributes by hand. I strongly recomment to read 'How-to access the column value of the selected table row' and use this technique.

                    Never ever you should use createRootApplicationModule in the way you did. Check http://radio-weblogs.com/0118231/2009/08/20.html#a959 please.

                    If you provide a use case we are glad to point you into the right direction.

                    Timo
                    • 7. Re: getting certain column's data of slected row from table
                      931841
                      Thank you Timo ...its always good to listen good advice .....

                      I ll certainly try the way that link suggest
                      • 8. Re: getting certain column's data of slected row from table
                        Sudipto Desmukh
                        On the other hand the same code could have been executed in the AMImpl.java where you would already have a handle to the AM transaction and the viewObjects.