Forum Stats

  • 3,781,282 Users
  • 2,254,499 Discussions
  • 7,879,632 Comments

Discussions

How can I make columns in an 'af: query' searchable based on a value in another table?

2731442
2731442 Member Posts: 22
edited Jul 8, 2015 5:56AM in JDeveloper and ADF

I have 2 tables. Table A (parent), and Table B(child). 

Table A has a primary key TableAID and 10 attributes... AttributeA01On, AttributeA02On, etc. All of the attributes are a LOV with 3 options:OFF, KEY, VAL.

Table B has a primary key TableBID, foreign key TableAID, and 10 attributes... AttributeB01, AttributeB02, etc. these attributes store number values related to the project I am working on.

I created a Form for Table B and I adjusted the properties to only render fields that are not OFF. I did this by using this equation in the "rendered" property--->#{bindings.AttributeA01On.inputValue ne 'OFF'}

Now I am trying to make something similar. I want to make a query panel that only has the fields marked as 'KEY' to be searchable at runtime. Does anyone know how to do this?

Thanks!

Tagged:

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,770 Red Diamond
    edited Jul 6, 2015 3:39AM
  • 2731442
    2731442 Member Posts: 22
    edited Jul 6, 2015 1:41PM

    Hi Timo,

    Unfortunately the link you provided doesn't address the issue I have.

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,770 Red Diamond
    edited Jul 6, 2015 1:17PM

    I did not say so. The hint was on how to remove attributes from a af:query by changing the EO attribute queriale property.

    Timo

  • 2731442
    2731442 Member Posts: 22
    edited Jul 7, 2015 9:59PM

    Bump. Any ideas?

  • Naresh Tammineni
    Naresh Tammineni Member Posts: 91 Blue Ribbon
    edited Jul 8, 2015 5:56AM

    create a transient attribute "Ex: city" in parent vo.

    create view criteria in parent VO

    drag that criteria into page

    call this method on search.

        public void queryChildVO() {

            ViewObjectImpl parentVO = this.getParentRVO();

            ViewCriteria vc =

                parentVO.getViewCriteria("ParentRVOCriteria");

            ViewCriteriaRow vcr = (ViewCriteriaRow)vc.get(0);

            String city1 = (String)vcr.getAttribute("city");  // Parent transient Attribute

            String cityOperator = vcr.getOperator("city");

            if (parentVO.first() != null) {

                ViewObjectImpl childVO =

                    (ViewObjectImpl)((RowSet)parentVO.first().getAttribute("ChildRVO")).getViewObject();

                ViewCriteria vc1 = childVO.createViewCriteria();

                ViewCriteriaRow vcRow1 = vc1.createViewCriteriaRow();

                vcRow1.setAttribute("City", city1);

                vcRow1.setOperator("City", "=");

                childVO.applyViewCriteria(vc1);

            }

            RowSetIterator rsi = null;

            try {

                rsi = parentVO.findRowSetIterator("iter");

                if (rsi == null) {

                    rsi = parentVO.createRowSetIterator("iter");

                }

                rsi.reset();

                while (rsi.hasNext()) {

                    Row row = rsi.next();

                    RowSet empRs =

                        ((RowSet)row.getAttribute("ChildRVO"));

                    empRs.executeQuery();

                }

            } finally {

                if (rsi != null) {

                    rsi.closeRowSetIterator();

                }

            }

        }

    Thanks,

    Naresh

This discussion has been closed.