Forum Stats

  • 3,854,194 Users
  • 2,264,340 Discussions
  • 7,905,598 Comments

Discussions

How search row in table from method in Application Module .

Leandro Vitale
Leandro Vitale Member Posts: 39
edited Nov 30, 2016 8:39AM in JDeveloper and ADF

Hello, i want search one row for a id in the Application Model, but i dont know what method use in my getAbmRequerimientoReclamoView1(). Any idea?

I use JDeveloper 12c

asdasd.png

Thanks!

Tagged:

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,756 Red Diamond
    edited Nov 29, 2016 3:39PM

    If the I'd I'd the primary key of the view object you can use findRowBtKeyValue(id)

    If not you can create a view criteria and user this to get the row.

    Timo

  • Leandro Vitale
    Leandro Vitale Member Posts: 39
    edited Nov 30, 2016 8:03AM

    Anda where can use method findRowBtKeyValue(id)? I dont find

  • Leandro Vitale
    Leandro Vitale Member Posts: 39
    edited Nov 30, 2016 8:35AM

    I resolved with this code:

    //Primary key value if you have Number then replace with anotherVariable

        String currid = "A001";

      

        // 1. Access the binding container

        DCBindingContainer bc = (DCBindingContainer)getBindings();

     

       // 2. Find a named iterator binding

        DCIteratorBinding iter =

          (DCIteratorBinding)bc.findIteratorBinding("AdfCalendarINSERTIterator");

     

        // 3. Create a Key object

        Key key = new Key(new Object[] { currid });

      

        //4. Get the RowSetIterator Object

        RowSetIterator rsi = iter.getRowSetIterator();

      

        //5. Find the row in the Iterator using findByKey funtion by passing Key object

        Row row = rsi.findByKey(key, 1)[0];

      

       // 6. Set the Current row in Iterator (findByKey does not Navigate to current row)

        rsi.setCurrentRow(row);

    Leandro Vitale
  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,756 Red Diamond
    edited Nov 30, 2016 8:39AM

    OK, my fault.

    If you want to search from within an application module method you use the findByKey method of the VO which will give you the row for the primary key.

    If you search from a page or bean you use setCurrentRowWihtKey or setCurrentRowWihtKeyValue from the data control of the VO.

    In your case the findByKey method from the VO can be used if the id you pass is the primary key.

            Key key = new Key(new Object[]{id});        Row row = vo.findByKey(key, 1);

    Timo

    Leandro Vitale
This discussion has been closed.