Setting current row using a string key in an iterator

Hi ,
I am using Studio Edition Version 11.1.1.6.0 and integrated wls.
QUESTION:_
As suggested by Sudipto i want to brief up my query.
I have a master-detail relationship .Using that relation's Tree model i am displaying through an <af:iterator> . I want to set the current row in the iterator of the parent view object . Is there a way please help .
Description:_
I have 2 master-details tables . FormSections is the mater and SectionContents is the child.
I have an use case and using the tree collection model in an iterator to display the nodes.The jsf page has the following markup
<iterator id="i1" value="#{bindings.FormSectionsView1.collectionModel}"
var="section">
<decorativeBox id="db2">
<facet name="top">
<commandLink text="#{section.Sectionname}" id="cl1">
<showPopupBehavior triggerType="action" popupId="p1"/>
</commandLink>
</facet>
<facet name="center">
<iterator id="i2" value="#{section.children}" var="field">
<outputText value="#{field.Fieldlabel}" id="ot3"/>
</iterator>
</facet>
</decorativeBox>
</iterator>
on the popup p1 i have #{DesignBean.createField} popupfetch listener.Now i want to insert a new row in the child when i click on the commandlink.
I have tried the following
1) Tried binding setCurrentRowWithKey and setCurrentRowWithKeyValue (namedvalue as #{section.Sectionid}) but there was no change i get the current row set to empty
2) Tried using the following bean codes
a) DCBindingContainer bindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding sectionsIterator =
(DCIteratorBinding)bindings.get("FormSectionsView1Iterator");
System.out.println(sectionsIterator.getCurrentRow());
String key_str="21";
sectionsIterator.setCurrentRowWithKeyValue(key_str);
          executeOperationBindings("CreateInsert1");// child createinsert binding execution
     b)     DCBindingContainer bindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding sectionsIterator =
(DCIteratorBinding)bindings.get("FormSectionsView1Iterator");
System.out.println(sectionsIterator.getCurrentRow());
String key_str="21";
Key key=sectionsIterator.createKey(key_str);
if(key!=null)
sectionsIterator.setCurrentRowWithKey(key.toStringFormat(true));
          executeOperationBindings("CreateInsert1");
          Now i have a problem of setting the parent to the current row on the iterator of the parent i am getting null pointer exception when tried to set the key.
Thanks,
Raj
Edited by: RajaSekharReddy.M on Jan 30, 2013 6:11 AM
Edited by: RajaSekharReddy.M on Jan 31, 2013 4:39 AM

Rajasekhar ,
What model layer do you use ? If ADF BC then shouldn't the parent child relationship already been defined as a View Link ?
Also I'm a little confused as to why you are setting a hardcoded the key with a string , since you are clicking the command link from the row , you should be accessing it as
#{section.sectionId}
Also I didnot understand this line-
Now i have a problem of setting the parent to the current row on the iterator of the parent i am getting null pointer exception when tried to set the key.A small tip is you can start giving briefly what you are trying to achieve and whats failing to get accurate replies . Please refer -
https://forums.oracle.com/forums/ann.jspa?annID=56

Similar Messages

  • How to get current row using submit button ?

    Hello Friends ,
    Is there any way i can capture the value of current row by submit button ?
    Here is my requirement , i have seeded OAF screen and it has table region one of the column has radio button , the existing
    functionality is when ever the radio button is selected and click on submit button ( submit button attached on top of the table region )
    other oaf page is getting opened .
    Now i wish to restrict the navigation based on some condition , but i don't know how to get the current row using submit button .
    Note : there is no Fire Action event for radio button column ? I dont' know how orale is selecting a specific row
    Any suggestion please ?
    Regards ,
    Vamsi

    Thanks sushant for your response ,
    Well i have tried your approch , i am not getting values for current row .
    if (pageContext.getParameter("paApply") != null)
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject localOAViewObject1 = (OAViewObject)am.findViewObject("ProjectDatesVO");
    if(localOAViewObject1!=null) {
    Row DateVoROw = localOAViewObject1.first();
    RowSetIterator iterator = localOAViewObject1.createRowSetIterator("iterator");
    iterator.setRangeStart(0);
    iterator.setRangeSize(localOAViewObject1.getRowCount());
    for(int i=0; i<iterator.getRowCount(); i++)
    DateVoROw=iterator.getRowAtRangeIndex(i);
    String vacancyValue= DateVoROw .getAttribute("vacancyname).toString();
    Could you please let me know where i am going wrong
    Thanks again ,
    Vamsi

  • LOV switcher and set current Row

    Hi
    I have a LOV switcher attached to one of the columns in the view object.
    It works fine while switching the LOV's in mostly all conditions.
    But its failing for one case.
    We are using checkboxex to select a row , and do a operation in the row.
    To do this, the button on which the operation is performed ...
    1)we have checked which row has the transient value of check box as checked
    2) Set the current row of the iterator to the row that comes from the selected check box index..
    3) Called the operation.
    But as the code go to step two and the current row is set to the required row, all the LOV 's in all the rows start showing the Default LOV which is selected in the LOV switcher, if i do a f5 fr the page, the original values are restored.
    Also if the VO fecth size is 25 , it gives wrong value for 25 rows, if i scroll through the table again it automatically shows the correct value.
    This has been taking a lot of out time to debug the issue.
    I guess its somethng to do with LOV switcher , set current row and the table getting refreshed incorrectly on set current row

    Hi Timo ,
    Thanks fr the reply..
    Jdev 11.1.1.4
    Code for checkbox selection
    DCBindingContainer dcbindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding iterator =
    dcbindings.findIteratorBinding(iteratorName);
    Row[] rowSet = iterator.getAllRowsInRange();
    Integer selectCount = 0;
    for (Row row : rowSet) {
    Object selAtt = row.getAttribute(selectAttribName);
    if (selAtt != null && (Boolean)selAtt == true) {
    System.out.println("Row selected");
    selectCount++;
    if (selectCount > 1) {
    System.out.println("More than one row selected!");
    throw new ValidationException("More than one row selected");
    else{
    iterator.setCurrentRowWithKey(row.getKey().toStringFormat(true));
    } else {System.out.println("Row not selected");}
    I actually sorted the issue out
    had to write
    iterator.refresh(Row.REFRESH_CONTAINEES); after iterator.setCurrentRowWithKey(row.getKey().toStringFormat(true));
    But not sure if thts correct ...

  • How to set current row in table after use tab key on inputText

    Hello all,
    My first post .., I'm newbie in ADF and I will try to explain my problem.
    For the moment we use ADF 11g (11.1.1.4), in a jsff page I have a table with an inputText column.
    On the valueChangeListener of the inputText, I invoke a method in a viewScope bean which call an EJB method, make some services in the EJB on the line modified. After that I refresh the VO and the table (because others values on the line have been modified) and reset the focus on the same inputText modified by the user with javaScript because focus was lost after refresh.
    So far, everything works fine.
    When I use the arrow keys to change the selected row in the table, it's work fine (focus is still in the next or previous inputText), but if user try to use tab key to change the current line, the inputText on the next line have the focus but the current row of the table is not changed (I think it's normal).
    My question : how can I change the current row after tab key pressed in this case ?
    I don't know if it's really clear, not easy to explain, don't hesitate to ask more details.
    Thanks in advance.

    Frank Nimphius wrote:
    Hi,
    My question : how can I change the current row after tab key pressed in this case ?
    Use a client event to listen for the keyboard entry and intercept the tab. The use af:serverListener to call the server to set the rowKey on the table and issue a PPR for the table to re-paint
    See sample 11 on http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html#CodeCornerSamples
    to learn about how to use the client listener and server listener
    FrankHi,
    Thanks a lot for your advices, I used the client and server listener
    I used this code on the method call in order to change the selection after key tab pressed, I don't know if it can be easier, but it works.
              if (LOGGER.isDebugEnabled()) {
              LOGGER.debug("START changeSelectedRow");
              RowKeySet oldRowKeySet = myTable.getSelectedRowKeys(); // get oldRowKeySet
              if (oldRowKeySet == null) {
                   if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug("oldRowKeySet is null");
                   return;
              RowKeySetImpl newRowKeySet = new RowKeySetImpl(); // The new RowKeySet use to change the selectedRow
              DCIteratorBinding bindingIterator = ADFUtils.findIterator(MY_ITERATOR);
              bindingIterator.setRangeSize(-1);
              // set the new index of the current row.
              int index = bindingIterator.getCurrentRowIndexInRange();
              if (index < bindingIterator.getAllRowsInRange().length - 1) {
                   index++;
              bindingIterator.setCurrentRowIndexInRange(index);
              // get the current row after changed the index
              Row currentRow = bindingIterator.getCurrentRow();
              if (currentRow != null) {
                   ArrayList nextLst = new ArrayList(1);
                   nextLst.add(currentRow.getKey());
                   newRowKeySet.add(nextLst);
                   // set the new selectedRow
                   myTable.setSelectedRowKeys(newRowKeySet);
                   SelectionEvent selectionEvent = new SelectionEvent(oldRowKeySet, newRowKeySet, myTable);
                   selectionEvent.queue();
                   AdfFacesContext.getCurrentInstance().addPartialTarget(myTable);
              if (LOGGER.isDebugEnabled()) {
                   LOGGER.debug("END changeSelectedRow");
    Best Regards
    Benjamin

  • How do I set an Apex mulri-row reports form value for the specifc current row using Javascript?

    I have a multi-row region based on a table in which I have two particular columns of interest.  The first has an LOV defined for which I have set up a pick-list of codes associated with the item's status as "OK" or having some problem, for which there are a small number of set codes associated.  Most rows will be OK, but when there is a problem, the pick-list will be used.
    When that pick list has been used, there is an optional "comments" column that can be filled in.  I want my screen to dynamically enable/disable a pushbutton that links to the comment based on the code.  This being row-based, the push-button needs enabling or disabling by row, not as a whole "conditional column".  That bit is ok, I think, but I don't know and can't find the syntax for how within the javascript onchange function I set the current row value for a different column to the one that triggered it.
    My header function (that doesn't work) is going to be something like this (where the status column LOV having a value = 6 means "OK").  Note I'm using alert for a debug mechamism.  The $s line is my failed attempt to set he column value, here with a hard-coded string "Changed COMMENTS":
    <script type="text/javascript">
    function doActivateButton(object)
      if(parseInt(object.value)!='6')
        alert('It is not 6!');
        $s('#COMMENTS','Changed COMMENTS','Changed COMMENTS',TRUE);
      else
        alert('It is 6, you know!');
    </script>
    Ideally, I want any existing comments blanked if the user picks "OK" (6) as the new status, whereas for debug above I'm setting the hardcoded debug string.  You will probably also note I realise I haven't properly understood the purpose of the third parameter in the $s API.
    (This is a reports region, by the way.  A detail block, in forms-speak, with a header block above it.)
    Thanks for any assistance.
    Mark

    Sorry, versions are: Apex 4.1 on Oracle RDBMS 11.2.

  • Need to Set Current Row when Using Built-in Data Control Delete Operation?

    I have an af:table bound to a ViewObject (VO) collection (no Entity Object) - within each row, I include a column that contains a 'Remove' command button so the user can remove the row. I add the command button by dragging/dropping the built-in delete operation from the VO on the Data Control Palette. When I use this as is (no changes), the Remove button always deletes the first row in the collection, not the selected row. Do I need to add code to set the current row, and if so can someone please provide an example and specify where I need to add? thanks.
    ------ .jspx af:table with command button to remove each row ------
    <af:table value="#{bindings.ListView1.collectionModel}" var="row"
    rows="#{bindings.ListView1.rangeSize}"
    first="#{bindings.ListView1.rangeStart}"
    // note: I don't have any code added for selectedRow or makeCurrent - assuming this is built-in?
    selectionState="#{bindings.ListView1.collectionModel.selectedRow}"
    selectionListener="#{bindings.ListView1.collectionModel.makeCurrent}">
    <af:column>
    <af:commandButton actionListener="#{bindings.Delete.execute}"
    text="Remove"
    disabled="#{!bindings.Delete.enabled}"/>
    </af:column>
    ---------- corresponding pagedef file ------------
    <bindings>.....
    <action id="Delete" IterBinding="ListView1Iterator"
    InstanceName="SrchDataControl.ListView1"
    DataControl="SrchDataControl" RequiresUpdateModel="false"
    Action="30"/>
    </bindings>
    Note: I also tried solution posted on following thread, but again, only first row is deleted, not the selected row?: Delete and Commit
    Message was edited by:
    javaX

    I just want to delete (or remove) it from the VO. Data for this VO is not on the database.
    The function is doing what I want it to do (delete from the VO), its just always deleting the first row, versus the selected row. I select the command button next on a column next to an item further down in the list and it deletes the first row. The problem is setting the selected row to be removed - I thought setting the current row would be taken care of by the SelectListener?
    selectionState="#{bindings.MyIspListView1.collectionModel.selectedRow}"
    selectionListener="#{bindings.MyIspListView1.collectionModel.makeCurrent}"

  • How to set current row in calendar

    Hi All,
    I am implementing ADF calendar using ADF faces. When i click on any activity the current row selected is not being displayed. Instead it always points to the last row of the VO.
    How to i explicitly set the current row to the selected row.(this can be declaratively achieved in tables selectedRow property)
    Thanks
    Sandeep.G

    Use the following code to default the calender date to today's.
      public void initializeSearchFormData()
        String methodName = "initializeSearchFormData()";
        _logger.entering(CLAZZ_NAME, methodName);
        MapDataSearchFormVOImpl searchDataVO = getMapDataSearchForm();
        // only create if we don't have any rows yet
        if (searchDataVO.getEstimatedRowCount() == 0)
          _logger.logp(Level.FINEST, CLAZZ_NAME, methodName,
                       "Creating new row for MapDataSearchFormVOImpl.");
          MapDataSearchFormVORowImpl newRow =
            (MapDataSearchFormVORowImpl) searchDataVO.createRow();
          newRow.setSELECT_DATE(DateTimeUtil.singleton().getCurrentJboDate());
          searchDataVO.clearCache();
          searchDataVO.insertRow(newRow);
          searchDataVO.setCurrentRow(newRow);
       * Container's getter for MapDataSearchForm.
       * @return MapDataSearchForm
      public MapDataSearchFormVOImpl getMapDataSearchForm()
        return (MapDataSearchFormVOImpl) findViewObject("YOUR VO NAME");
        _logger.exiting(CLAZZ_NAME, methodName);
      }Regards,
    Kiran Konjeti

  • Set current row with key

    i have 3 tables master-details. for example I have tables a,b,c. table a is master for table b and b is master for table c .
    on first page I display a and b data as ADF master table- detail table when I click on submit button should be go to page tow to create new record in table c and set the FOREIGN KEY .

    If you have view links specified, then it's handled automatically (like Frank said). Suppose the following data model:
    Companies - Departments - Employees
    Make sure there exists an instance of the Companies VO in your datacontrol having Departments as a child and the Departments having Employees as child. If not create it in the data model of your service.
    Companies
    ->Departments
    -->Employees
    I will try to make an example today.
    Regards,
    Koen Verhulst

  • Create Row Next to the current row using the enter or tab key

    hi
    May my needs is not correct with web development, so in some pages like Journal Voucher Entery, the user need to add about more than 200 row, if there is any soluation to handle such status please send to me. the user ask not to press add or create button each time.
    thanks

    Hi,
    Excel has no direct feature or option to achieve your goal. We'd better try the macro via VBA code to test. Please see the thread:
    http://excel.tips.net/T003923_Automatically_Moving_from_Cell_to_Cell_when_Entering_Data.html
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    If you have further question about code, I recommend you follow with thread which you posted in MSDN forum:
    http://social.technet.microsoft.com/Forums/en-US/6f5344cf-c1b5-485d-982a-eeec45294f9b/ms-excel-move-automatically-without-pressing-enter-or-tab?forum=exceldev
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Setting current row of a view based on row selected from another view.

    Hi,
    We have two Views V1 and V2. Both views are based on the same tables except that V1 is based on multiple tables. In our application we are showing a read only table which is based on V1. The user can select a particular record for edit. But the edit page is based on V2 and as a result the first record always shows up for editing even though the user may have selected another record.
    Is there a way we can pass the primary key of the record selected from V1 to V2 and set that record as the current record.
    We have tried setCurrentRowWithKey, but this did not help.
    Regards
    RHY

    Hello,
    post the PK as an URL parameter within the link you open the edit page. Then read this parameter in your page (the page with this link) action class and send it to an ActionBinding:
    JUCtrlActionBinding action = (JUCtrlActionBinding) bc.findCtrlBinding("nameOfBinding");
    ArrayList arrayList= new ArrayList();
    arrayList.add(0,primaryKey);
    action.setParams(arrayList);
    action.doIt();
    In your AppModule create a method nameOfBinding with primaryKey as in parameter
    public void nameOfBinding (Number primaryKey )
    getV2().setWhereClause("PRIMARY_KEY=:0");
    getV2().setWhereClauseParam(0,primaryKey );
    getV2().executeQuery();
    In the AppModule you have to publish this method in "ClientInterface".
    Create an Action binding for this method in your list jsp.
    Hope this helps
    Britta

  • Set Current row by value

    Hi,
    I have been playing with this....
    <div spry:region="dsEmployees">
    <ul spry:repeatchildren="dsEmployees">
    <li spry:if="{ds_CurrentRowNumber} == {ds_RowNumber}"
    class="selected" id="foo"><div
    style="width:200px;">{firstname} {lastname} (id:
    {@id})</div></li>
    <li spry:if="{ds_CurrentRowNumber} !=
    {ds_RowNumber}">{firstname} {lastname} (id: {@id})</li>
    </ul>
    </div>
    I was wondering if there is a way to set the id to:
    id="foo1"
    id="foo2"
    id="foo3"
    etc...
    for the li that match?

    Hi, jonnysoco,
    I'm not sure I'm understanding you correctly, but are you
    asking "how do I place an id attribute on my <li> tags that
    contain the value of my {@id} data reference?
    If so, just use the data reference like you normally would,
    but in the id attribute:
    <li id="foo{@id}" ...>
    When the region re-generates the markup, assuming {@id}
    evaluates to some unique number, you'd end up with:
    <li id="foo0" ...>
    <li id="foo1" ..>
    etc.
    --== Kin ==--

  • ADF 10.1.3.3 - Set current row on detail table in master/detail

    I want my master/detail form to remember the row the user selected in the detail table before pressing submit/commit.
    Today is it always the last row displayed that default is selected.
    How can that be accomplished ?
    Message was edited by:
    jsteenberg
    Message was edited by:
    jsteenberg

    Which technology are you using?

  • Set current row background color

    during post-query process, if record meets condition,
    i would like to set the color of entire line.
    thank you
    [email protected]

    Hi Jim,
    create a visual_attribute named e.g. PQR and set the desired background color.
    In post-query trigger:
    declare
         currec number := Get_block_property('block1', current_record);
    begin     
    if "condition" then
         set_item_instance_property('item1',     currec,visual_attribute,'PQR');
         set_item_instance_property('item2',     currec,visual_attribute,'PQR');
         set_item_instance_property('item3',     currec,visual_attribute,'PQR');
    end if;
    end;
    Good luck,
    Monica

  • After commit current row is no longer highlighted

    JDeveloper 11.1.1.20.
    Scenario: a master detail page where master and detail are both ordinary ADF table ( NOT read-only).
    If I place the cursor on a master row and do a click the row is highlighted.
    If I do a createInsert operation (with a button) a new row is created above the previous mentioned row.
    Problem:
    If I do a commit after the new row is filled with data sometimes the newly made row is now longer highlighted after the commit.
    The newly created row is stil active. This is seen by the fact that if I subsequently creates a new deatil row it is correctly connected to the newly created master row.
    And - after the newly created detail row is created the master row is again highligted.
    Any ideas?
    Best regards
    Erik

    Hi,
    To keep highlight the selected row do some operation in bean ,Get selected row and set that row again after commit
    Check
    http://jobinesh.blogspot.com/2011/01/declaratively-setting-current-row-key.html

  • How to get Current Row information

    Hi,
    Actually i have an lov item and when user enters some value in the lov and just tabs out the process request method on the lov region is fired. Now the lov item is in a advance table and table has lets say 5 rows.
    Now the user enters some invalid value in lov item of say 3 row and tabs out of the lov. As a result the lov popup gets enabled and process request at the lov region is called.
    Now my requirement is in the process request of lov region i want to get hold of the current row of view object.
    I have attached a controller at the lov region and i have put system.out.println at process request method.
    The control is going there, now when i grab the VO and do getCurrentRow() it doesn't return anything.
    Actually i know that we can capture the tab out event using pageContext.islovevent but it gets fired only for valid values in lov input. for invalid values process request is called at the lov region.
    Kindly put some light on it.
    Thanks,
    Gaurav Sharma

    Actually, when the user tabs out of the lov then if there's a valid value in lov then lovValidate event is fired and lov is not popped up. But for invalid values lovvalidate event is not getting fired but control goes to the process request of lov region.
    My requirement is that i have two lovs in an advance table region . one for Country and one for State.
    Now i want that as the user enters some value in State lov and tabs out then as the lov gets popped up then it should pick up the value in Country LOV and based on that Country it should display the results for the current row as there may be multiple rows on advance table.
    Now there are two things, when user clicks on lov torch on state then lov prepare event is fired and then i am able to grab the the country for the current row using row reference.
    But when user enters some invalid value in state lov and tabs out then no event is fired, rather than this process request is called at the lov region . Now how can i capture the value in Country lov of current row.
    Thanks,
    Gaurav
    Edited by: [email protected] on May 21, 2009 4:59 AM

Maybe you are looking for

  • Default to a specific domain username on restart

    Hi Experts, A quick question, How do I get back the username of a computer user on start up after logging in with another account? The user must press ctrl+alt+del on startup to display his/her username Case scenario: I logged on to a machine using [

  • Computer went into sleep mode and will not wake up!

    I have a HP Pavilion a350n which I love and have never had a problem with it.....until now. When I turn it on I get a black screen with a small window that reads "Warning" "PC entering power saving mode"  Then the screen goes blank and the blue power

  • SSIS packages are executed from buffer??

    Hi, I am passing a set of variables from parent SSIS package to child SSIS package through package configuration. 6 variables should be passed from parent to child. When I first developed this package, I accidentally omitted 2 variables. Hence only 4

  • Long cable for iMac TV connection?

    I see there are cables that will connect an iMac and an external monitor or a TV. My iMac and TV are in different rooms. The cable would have to be 30' to 50', depending on how I route it. Do they make one that big? Do they make extenders? Can the ca

  • ITunes 11.1 keeps freezing after upgrading to iOS7

    I upgraded my iPhone 5 to iOS7 yesterday and also downloaded iTunes 11.1. Now whenever I plug my iPhone into iTunes, it takes ages for it to recognise my iPhone and when it does it starts to back up and then freezes my entire iTunes.