DB-Adapter 10g: Filtering Detail-Rows in Master-Detail-Relationship

Hi,
I'm having a Master-Detail-Table e.g. Departments and Employees. Those are mapped with 1:N FK-Relationship. Using the Oracle SOA-Suite 10.1.3.5 DB-Adapter I'd like to setup a filter returning all Departments and all (e.g.) female Employees.
For the example see: http://docs.oracle.com/cd/E11036_01/integrate.1013/b28994.pdf (chapter 4.3.9). Unfortunately, this doesn't work. If definining a where-clause empCollection.gender='female' I get the following behavior:
- If a dept has no female emp, this department is not shown at all (however I want it to be empty)
- If there is at least one female emp, the department and all employees are shown.
Any idea on how to solve this problem would be highly appreciated!
Regards,
Johannes

I gave it a try, 2 problems:
1) the outer-join seems to be wrong. it provides me only departments that have at least one female employee. If I change that outer-join to:
select DEP.id,DEP.name, EMP.id,EMP.GENDER
from EMP, DEP
where EMP.DEP_ID(+)=DEP.id
and emp.gender(+)='female'
it gives me what I want from sqldeveloper:
select * from emp;
ID NAME
1 empty
2 mixed
3 male
4 female
select * from dep;
ID DEP_ID GENDER
1 2 male
2 2 female
3 2 male
4 3 male
5 3 male
6 4 female
7 4 female
8 4 female
select DEP.id,DEP.name, EMP.id,EMP.GENDER
from EMP, DEP
where EMP.DEP_ID(+)=DEP.id
and EMP.GENDER(+)='female'
ID NAME ID GENDER
1 empty
2 mixed 2 female
3 male
4 female 6 female
4 female 7 female
4 female 8 female
2) However that doesn't solve my problem with the BPEL-Adapter. There I still get the folowing result:
<DepCollection xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/test4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Dep>
<id>2</id>
<name>mixed</name>
<empCollection>
<Emp>
<id>1</id>
<gender>male</gender>
</Emp>
<Emp>
<id>2</id>
<gender>female</gender>
</Emp>
<Emp>
<id>3</id>
<gender>male</gender>
</Emp>
</empCollection>
</Dep>
<Dep>
<id>4</id>
<name>female</name>
<empCollection>
<Emp>
<id>6</id>
<gender>female</gender>
</Emp>
<Emp>
<id>7</id>
<gender>female</gender>
</Emp>
<Emp>
<id>8</id>
<gender>female</gender>
</Emp>
</empCollection>
</Dep>
<Dep>
<id>3</id>
<name>male</name>
<empCollection>
<Emp>
<id>4</id>
<gender>male</gender>
</Emp>
<Emp>
<id>5</id>
<gender>male</gender>
</Emp>
</empCollection>
</Dep>
<Dep>
<id>1</id>
<name>empty</name>
<empCollection />
</Dep>
</DepCollection>
This is how I used the wizard:
1_Select_Table.png
2relationship.png
3objectfiltering.png
4selection_Criteria.png
Any futher ideas?
Edited by: Johannes M on 17.01.2013 12:31
Edited by: Johannes M on 17.01.2013 12:34

Similar Messages

  • How to access detail-rows in master-detail form?

    I have a master-detail form(one to many relationship). The master and detail are in separate blocks. The detail rows are displayed in a tabular form.
    I need to access the detail-rows since the database writes for the detail rows will be managed by a procedure.
    I have been looking through the documentation and have been unable to find any syntax for iterating through the detail-rows.
    Any help is appreciated. Thanks.

    go_block(detail)
    first_record;
    in a loop while not last_record
    -- do your stuff
    next_record;
    end loop;

  • Inserting rows in master-detail views

    I have two VOs connected by a view link. I want to insert new rows in both the master VO and the detail VO and connect them together.
    I have the following:
    MasterEO (mapped to master_table)
    MasterVO (defined on MasterEO)
    DetailEO (mapped to detail_table)
    DetailVO (defined on DetailEO)
    MasterDetailAO (1 to many Association between MasterEO and DetailEO. master_id in detail_table references id in master_table)
    MasterDetailVL (1 to many ViewLink defined on MasterDetailAO)
    My AM looks like:
    MasterVO
    DetailVO via MasterDetailVL1
    I am trying to insert a new row in MasterVO, and a new row in DetailVO that should be linked to the new row in MasterVO. I used the code listed below. I was able to get the DetailEOImpl from the new row in DetailVO, and then get the new MasterEOImpl from the DetailEOImpl. However, when I called drow.getMasterVO() (drow being the new row created in DetailVO), I got null back instead of the new row in MasterVO. What do I have to do to connect the new row in MasterVO and DetailVO? (I got the same results regardless of whether the association is a composition or not)
    Also another thing I noticed, even though I've called setMaxFetchSize(0) on both VOs, the sql trace still shows the queries being executed. Is there anything else I need to do?
    MasterVOImpl master = (MasterVOImpl) testAM.findViewObject("MasterVO");
    DetailVOImpl detail = (DetailVOImpl) testAM.findViewObject("DetailVO");
    master.setMaxFetchSize(0);
    detail.setMaxFetchSize(0);
    MasterVORowImpl mrow = (MasterVORowImpl) master.createRow();
    mrow.setId(new oracle.jbo.domain.Number(10));
    master.insertRow(mrow);
    DetailVORowImpl drow = (DetailVORowImpl) detail.createRow();
    drow.setDetailId(new oracle.jbo.domain.Number(100));
    detail.insertRow(drow);
    DetailEOImpl deoi = drow.getDetailEO();
    MasterEOImpl meoi = deoi.getMasterEO();
    if (meoi != null)
    System.out.println("ID from EO: " + meoi.getId()); // This value is correct
    Row mrw = drow.getMasterVO(); // RETURNS NULL INSTEAD OF THE NEW ROW
    if (mrw != null)
    System.out.println("Row Class from Detail VO: " +
    mrw.getClass().getName());
    else
    System.out.println("Master VO is null");
    // THE OTHER DIRECTION ALSO DOESN'T WORK
    RowIterator rt = mrow.getDetailVO();
    DetailVORowImpl dd = (DetailVORowImpl) rt.first();
    // dd IS NULL
    if (dd != null)
    System.out.println("New Detail Row: " + dd.getDetailId());
    else
    System.out.println("New Detail Row from Master is null");

    You need to make your ViewObjects 'AssociationConsistent' for all collections to see new rows inserted into the cache. To set this setting for all VOs, edit your Appliation Module configuration and set the value for jbo.viewlink.consistent to be true.

  • Make detail items in master/detail form read only

    I want to make detail items in master/detail form read only for certain conditions (master STATUS = Closed). I see how to do this on the master record items but not on detail items.

    Take a look at this thread: Re: Conditionally make a tabular form uneditable
    You will need to modify the code, but it should help since a master detail is just a standard form with a tabular form attached to it..
    Thank you,
    Tony Miller
    Webster, TX
    Time flies like the wind, but fruit flies like bananas.

  • BC4J - To get the detail of details in a Master-Detail relationship

    Hi,
    I am developing an application in JDev using Buss Components for Java.
    I need to show the details from the details in a Master-Detail relationship of ViewLink Objects.
    e.g I am browsing through a list of book publishers, if I pick one book publisher, all the books published by this publisher should be displayed. And when I pick one book out of these, the list of buyers should appear for this book.
    Is it possible to do it via the wizards in JDev?
    If not, is their any other way of doing it?
    Thanks,
    Any help would be appreciated.
    null

    Sure. Arbitrary levels of master/detail are easy to handle. It's just the first time you set it up in the "Data Model" panel of your Application Module, the UI gestures may not be the most obvious.
    Depending on whether you need to just browse the data, or both browse and update it, you would decide whether or not you need underlying Entity Objects for Publisher, Book, and Buyer.
    To keep it simple, just assume you want to browse so the Entity Objects are not required to be involved.
    You would develop three View Objects:
    [list=1]
    [*]Publishers - with a query like SELECT publisher_name, publisher_id FROM PUBLISHER ORDER BY publisher_name
    [*]Books - with a query like SELECT title, isbn FROM book ORDER BY Title
    [*]Buyers - with a query like SELECT name, company FROM buyer ORDER BY company, name
    [list]
    Then, you define two View Links:
    [list=1]
    [*]BooksFromPublisher - linking the Publishers view to the Books view, and
    [*]BuyersForBook - linking the Books view to the Buyers view
    [list]
    Then, you define an Application Module that sets up the data model you want to work with in a particular application that reuses these reusable view object and view link components.
    On the "Data Model" tab, you'll see the master/detail views available in the "Available" list like this:
    - Publishers
    |
    +- Books
    - Books
    |
    +- BuyersTo construct a master/detail/detail view with these "raw ingredients" do the following:
    [list=1]
    [*]Click on Publishers in the Available list, and click (>) to shuttle it into the data model
    [*]In the data model tree, select the Publishers view to make it the active selection.
    [*]Back in the Available list, click on the Books view that is indented under Publishers and click (>) to use Books as a detail of the current view in the data model.
    [*]In the data model tree, select the Books view to make it the active selection.
    [*]Back in the Available list, click on the Buyers view that is indented under Bookss and click (>) to use Buyers as a detail of the current view in the data model.
    [list]
    Hope this helps.
    null

  • Insert a row in master detail view & jboRowKey parameter

    Hi
    I hava a minor problem.
    On JSP page I have edit form for master view, beyond edit form is browse of detail view. I would like to insert or edit a row on master view and after update and commit, a would like to stay on the same page to insert some rows into detail view.
    When I editing rows it is Ok, becose jboRowKey parameter is always the same (to find proper row on master view).
    Problem appears when I want to Insert a row into master view, becose after transaction is commited, jboRowKey parameter is changed.
    Primary key on master table is sequence and it is inserted by (preinsert) trigger before commit.
    If anybody has some idea to solve this problem, please help.
    Gorazd

    Without knowing exactly the technology you are using, (JDev version, BC4J JSP tags/Components tags?),
    In general with BC4J after you do a commit, you do not necessarily have a record pointer on the new record that you just insert on the master table, so you would have to locate it again.
    Here is one way you could do this.
    After you commit your new inserted record, you could go back to a master "browse" page which shows the records of your master table along with a link to it's corresponding detail page. Encoded in the link you could pass the rowkey of the master record as a parameter and then in the detail page you could locate the master record that was clicked on by using the Find operation of the Row tag. When the master row is located, you automatically would be pointing to the correct detail records.
    In this case since the master was just created, there wouldn't be any detail records yet. You could then create new detail records for the new master..
    Let me know if this helps..
    -Chris

  • Add a new row in Detail form in MASTER DETAIL FORM

    Hello Everyone,
    I need help on the following.I have master detail form .In detail form i have Add Row button which adds a new row and i have save button to save the record .But now if i am adding a row its not adding a new row .It says it process but didn't show the new row .
    Can somebody help me on this
    thanks in advance

    Hello,
    How many records do you show in your detaii region and how many are there for that master? Maybe the new row is in the next set of records - or at the 'bottom' of the last set of records?
    Did you check if the row is inserted in the database (and just didn't show up for one reason or another)?
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.logica.com/

  • Add Row in Master Detail Form

    Hi all,
    I wonder if there is a way to just Add Row in the master detail (tabular) form without actually submitting the page. So if user has updated any existing row before clicking the Add Row button, the update should not be submitted by Add Row button click. If this is possible, then I want to submit (insert) the newly added row as well as any updates made to the existing rows when user click the "apply changes" button.
    Any luck?
    Thanks for the help.
    Milaan

    Hi Andy,
    Thanks for your response. Here is what I am doing... On submit I am calling another page (popup) for user to enter electronic signature. So when they add row (which is a submit), it calls the electronic signature page popup, and only upon entering the signature (nuisance at this point) it adds a row in the tabular form. Is there a way to change this behavior to not to submit the page every time user click Add row button?
    Thnx
    Milaan

  • How to display more rows in Master-detail form

    I am working on APEX3.2.
    I have a master-detail form. The detail form always display 15 rows. However, my customer wants the detail display all the rows. I tries to configure the Number of Rows in the report. It doesn't work. How do I do it?
    Thanks a lot!

    Hi:
    To increase number of rows displayed you have to set Number of Rows and pay attention to both Number of Rows (Item) and Maximum Row Count.
    After that if didn't work, sign out or close the browser then open it again. Sometimes it keeps the value in current session.
    Saad,

  • About having multiple blank  rows on master detail form

    Can I have multiple blank rows on detail form when I create master detail form?
    please help me
    shuyue

    Let me answer my own question.
    Set the number of rows to 500 and it will dynamically set to the number of rows.

  • ADF 10.1.3.4: 'losing' newly created row in master-detail-detail.

    Situation:
    I have a page in JSF/ADF with the following set up.
    Top-half of the page is a table.
    Underneath the table is on the left a selectonelistbox component and next to it on the right a tabbed section.
    The table -> selectonelistbox relation is master-detail.
    The selectonelistbox -> tabbed section is master-detail.
    So when you change the selection in de seletonelistbox the data in the tabbed section changes.
    One of the functions in a tabbed section is a createinsert.
    step1: select value '1' in the selectonelistbox.
    step1: a new row is create (with createinsert). there is no commit yet, the row is in the entity cache.
    step2: change the selection to '2' in the selectonelistbox.
    step3: create a new row (with createinsert).
    step4: commit the changes.
    We see that only the row of the current row is committed. The newly created row under value '1' has disappeared.
    There are no warnings/exception thrown.
    How can I commit all newly created rows?
    It must be possible to created several new rows, before committing if it is possible.
    Some specs:
    JDeveloper 10.1.3.4.0
    using the embedded OC4J server
    JDK
    Thanks,
    Goldhorn

    Which technology are you using?

  • 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?

  • Master-Detail prevent inserting detail row if master doesn't exist

    Hello,
    I have a complex page that has several master-detail table pairs on it. I have what should be a simple problem to work around that I can't seem to figure out. On each table (either master or detail) I have a create button in the header and a delete button in each row. I have a couple issues I just can't seem to get past.
    1. How to disable the detail create button if no master row exists or one hasn't been selected by the user? (Right now you can create detail rows without a valid master row)
    2. How to disable the master row delete button if there are any (commited or not) detail rows present?
    I think I have figured out 2 by having a transient attribute on the master row that uses groovy and the view link accessor to count the detail rows. This appears to be working but if there's a better, cleaner solution I'm all ears. I just can't seem to get 1 working no matter what I try.
    Thanks for any help you can provide.

    hi,
    you can use estimatedRowCount of iterator to disable the button like
    disabled="#{!(bindings.mastervoIterator.estimatedRowCount ge 0)}"and use currentRow property to determint whether current row is selected like
    disabled="#{!(bindings.mastervoIterator.currentRow ne null)}"so the combination will be as follows
    disabled="#{!(bindings.mastervoIterator.estimatedRowCount ge 0 and bindings.mastervoIterator.currentRow ne null)}"hope this helps...
    Regards.

  • Add multiple rows in detail form in master detail form

    Hi,
    I have a master detail form to enter survey responses. The master form captures the participant information and the detail form will carry the survey responses. After entering the master record, I need the detail rows to be populated with the survey questions stored in another table. The respondent will then update the response for each row in the detail form. Only after all the responses are filled out, clicking the save button should the detail records be committed.
    Is there a good way to achieve this.
    Thanks in advance
    Gopal

    Sorry, did not check OTN until this afternoon. Busy checking existing Apex pages on my project :)
    Our region to populate the tabular form has the tabular form fields defined as Display As Text (saves state). Non-enterable fields are defined as "Display as Text (saves state)". A tabular form results from these definitions.
    Because Apex won't generate code to handle multipe row tabluar form inserts we wrote our own as an After Submit PL/SQL process, something like
    DECLARE
      v_rows_found_n number;
    BEGIN
      --code for debugging
      raise_application_error(-20000,'Hello World: '||
        apex_application.g_f03(12)||':'||
        apex_application.g_f04(12)||':'||
        apex_application.g_f05(12)||':'||
      for i in 1..apex_application.g_f01.count loop
        BEGIN
          --attempt update first
          update whatever
             set field4 = apex_application.g_f05(i)
           where field1 = apex_application.g_f03(i)
             and field2 = apex_application.g_f04(i)
             and field3 = apex_application.g_f02(i);
          v_rows_found_n := SQL%rowcount;
        --if no rows were updated perform an insert
        if (v_rows_found_n = 0) then
           insert into oe_metric_values(
             field1,         --1
             field2,         --2
             field3,         --3
             field4          --4
          values(
            apex_application.g_f02(i), --1: field1
            apex_application.g_f03(i), --3: field2
            apex_application.g_f04(i), --2: field3
            apex_application.g_f05(i)  --4: field4
        end if; --did update operate on any rows?
      --exception
      --  when others then
      --    raise_application_error(-20000,'i'||':'||
      --      apex_application.g_f03(i)||':'||
      --      apex_application.g_f04(i)||':'||
      --      apex_application.g_f05(i)||':'||
        END; --internal loop block
      end loop; --loop through tabular form submit elements
    end; --pl/sql blockI had to get the identities of the f01, f02 etc. identifiers by looking at the HTML code in the rendered form because Apex assigns those values as it will. Anytime the column display changes in any way i have to go through and make sure the identifers have not changed.
    Hope this helps.

  • Insert new row to master - detail form using bindingsource

    Hi all,
    I have a form to analyse price of product, the form include master (textbox:slip ID,datetimepicker : date) and detail(datagridview:slipID,productID,price..)
    When I insert new row as below code, all inserted to DB but not show on form, I must close and reopen the form the new row will show, how i must to do to fix it 
    please help, thanks
    Select data when form load 
    ds = New DataSet
    damaster = New SqlDataAdapter("select soPTG,ngaybd,ngaykt,khoa = case when sttesign =0 then 'True' else 'False' end from tbl_PTGMaster", conn)
    damaster.Fill(ds, "tbl_ptgMaster")
    dadet = New SqlDataAdapter("select [SoPTG],[Mahang],[gianhap],[thuesuat],[laigop],[giacu],[giamoi] from tbl_PTGDetail", conn)
    dadet.Fill(ds, "tbl_ptgdetail")
    ds.Relations.Add("PTG_rel", ds.Tables("tbl_ptgmaster").Columns("SoPTG"), ds.Tables("tbl_ptgdetail").Columns("SoPTG")).ChildKeyConstraint.UpdateRule = Rule.Cascade
    BindingMaster.DataSource = ds
    BindingMaster.DataMember = "tbl_ptgmaster"
    BindingDetail.DataSource = BindingMaster
    BindingDetail.DataMember = "PTG_rel"
    gridchitiet.DataMember = "tbl_ptgdetail"
    txtptgnumb.DataBindings.Add("text", BindingMaster, "soPTG")
    dtstart.DataBindings.Add("Text", BindingMaster, "ngaybd")
    dtend.DataBindings.Add("Text", BindingMaster, "ngaykt")
    cmdlock.DataBinding.Add("Enabled", BindingMaster, "khoa", True, DataSourceUpdateMode.OnPropertyChanged)
    setStatus()
    SetHeader()
    Dim cmdinsert As New SqlCommand("insert into tbl_PTGMaster(SoPTG,ngaybd,ngaykt) values(@SoPTG,@ngaybd,@ngaykt)", conn)
    cmdinsert.Parameters.Add("@soPTG", SqlDbType.Char, 10).Value = txtptgnumb.Text
    cmdinsert.Parameters.Add("@ngaybd", SqlDbType.DateTime).Value = dtstart.Value
    cmdinsert.Parameters.Add("@ngaykt", SqlDbType.DateTime).Value = dtend.Value
    damaster.InsertCommand = cmdinsert
    damaster.FillSchema(ds, SchemaType.Source)
    cmdinsert = New SqlCommand("insert into tbl_PTGDetail(SoPTG,mahang,gianhap) values(@SoPTG,@mahang,@gianhap)", conn)
    cmdinsert.Parameters.Add("@SoPTG", SqlDbType.Char, 10).Value = txtptgnumb.Text
    cmdinsert.Parameters("@SoPTG").Direction = ParameterDirection.InputOutput
    cmdinsert.Parameters.Add("@mahang", SqlDbType.Char, 10, "mahang")
    cmdinsert.Parameters.Add("@gianhap", SqlDbType.Decimal, 8, "gianhap")
    dadet.InsertCommand = cmdinsert
    dadet.FillSchema(ds, SchemaType.Source)
    gridchitiet.FinishEditing()
    BindingMaster.EndEdit()
    damaster.Update(ds, "tbl_PTGMaster")
    ds.Tables("tbl_PTGMaster").AcceptChanges()
    BindingDetail.EndEdit()
    dadet.Update(ds, "tbl_PTGDetail")
    ds.Tables("tbl_PTGDetail").AcceptChanges()
    BindingMaster.ResetBindings(False)
    BindingDetail.ResetBindings(False)

    Hello,
    The base idea here is if the record is added successfully you would then get the new primary key then manually add the record to the underlying data source. Does not matter if we are talking a single table or a master-detail setup.
    The following shows the basics
    https://code.msdn.microsoft.com/Adding-new-records-into-bff5eaaf 
    All of the above is done without using a DataSet yet the same thing needs to happen with a DataSet, simply focus on the one table.
    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.

Maybe you are looking for

  • F-47  Vendor Down payment

    Dear Sirs, I am trying to post a down payment through F-47 , but I am not able to see the Tax amount tab and Tax code Tab for one of the copmany code, but I could able to see the fileds for other comapny code Can anyone help me to tell, how this will

  • What is BDI or BDS spelled out? Jabber for Mac 9.2(1) Installation and Configuration Guide

    I'm spending the day catching up on Jabber/IM&P release notes across the server/clients. So I'm used to EDI and UDS, but we have a new acronym in the Jabber for Mac 9.2(1) Installation and Configuration Guide called BDI and BDS. However they don't de

  • Why when i purchase a app from windows store it pending why not directly install (windows 8.1

    please give me an explaination on my title 

  • Wierd file associations in Firefox

    Hi. I had lots of problems before with regular firefox, so I decided I'd give 'firefox-kde-opensuse' from AUR a shot. And while it's definitely better in terms of KDE intergaton, there still persists a rather funny bug. The problem is that with some

  • Delaying behaviors

    Hi there, I'm creating an image gallery & I'm trying to do the following, can anyone shed some light for me? What I am trying to do is this: thumbnail click - fades out old image, new image loads, new image fades in I have the behaviors working fine