Requerying on Master Detail form

Hi,
Does anyone know how to set up PL/SQL code to automatically requery on a master detail form after insert/update? For example, if I insert a record on the master part of the form, I would like that record to automatically show up after the insert/update. Also, if I insert a record on the detail part of the form, I would like that record to automatically show up after an insert/update.
Thanks,
Martin

Hi Krishnamurthy,
Thank you very much for the code. The code for the most part acts like I want it to except when I initally insert a master record. In my case, I have the form set up so you have to insert a master record before you can insert any detail records. Therefore, after the user clicks save, that master record needs to come up. The code you gave me only brings up the current master record if you are inserting detail records (which is great, that is what I want it to do). I have modified the code you gave me so when a user is just inserting the master record, the master record automaticaly comes up rather than the first record in the table. However my code makes the form run slow (about 13 seconds to save). Do you know of another way that I can make the form act like I want it to. Below is my code.
Thanks again,
Martin
declare
     l_msg                varchar2(255);
     l_key_value      number(10);
     l_key_value2      number(10);
     v_get_id           number(9);
     v_check_detail      number(9);
     CURSOR GET_ID IS
          SELECT MAX(A.PCH_ID)
          FROM PORTAL30.PCHEADER A;
     CURSOR CHECK_DETAILS IS
          SELECT DISTINCT B.PCD_ID
          FROM PORTAL30.PCDETAILS B WHERE B.PCD_PHC_ID = v_get_id;
begin
     /*get the key field value from the Master Detail form to requery the details since the form will be cleared out after update */
     l_key_value := p_session.get_value_as_NUMBER(
     p_block_name => 'MASTER_BLOCK',
     p_attribute_name => 'A_PCH_ID',
     p_index => 1
     doSave;--- This is the default handler
     OPEN get_id;
     FETCH get_id into v_get_id;
     CLOSE get_id;
     OPEN check_details;
     FETCH check_details into v_check_detail;
IF check_details%NOTFOUND
THEN
     CLOSE check_details;
     /*get the key field value from the Master Detail form to requery the details since the form will
     be cleared out after update */
     l_key_value2 := v_get_id;
     /*get the message which is going to be displayed after update */
     l_msg := p_session.get_value_as_varchar2(
     p_block_name => 'MASTER_BLOCK',
     p_attribute_name => '_STATUS');
     /*now set the key field value in the Master Detail */
     p_session.set_shadow_value(p_block_name => 'MASTER_BLOCK',
     p_attribute_name => 'A_PCH_ID',
     p_value => l_key_value2,
     p_language => PORTAL30.wwctx_api.get_nls_language);
     WWV_MASTER_GENSYS_1(p_block_name => null,
     p_object_name => null,
     p_instance => null,
     p_event_type => null,
     p_user_args => null,
     p_session => p_session);
     /*put the message(like 'Updated one master record' ) back in the screen */
     p_session.set_value(p_block_name => 'MASTER_BLOCK',
     p_attribute_name => '_STATUS',
     p_value => l_msg);
     p_session.set_value
     (p_block_name => 'MASTER_BLOCK'
     ,p_attribute_name => '_MASTER_ACTION'
     ,p_value => 'NONE');
     p_session.save_session();
ELSE
     CLOSE check_details;
     /*get the message which is going to be displayed after update*/
     l_msg := p_session.get_value_as_varchar2(
     p_block_name => 'MASTER_BLOCK',
     p_attribute_name => '_STATUS');
     /*now set the key field value in the Master Detail*/
     p_session.set_shadow_value(p_block_name => 'MASTER_BLOCK',
     p_attribute_name => 'A_PCH_ID',
     p_value => l_key_value,
     p_language => PORTAL30.wwctx_api.get_nls_language);
     WWV_MASTER_GENSYS_1(p_block_name => null,
     p_object_name => null,
     p_instance => null,
     p_event_type => null,
     p_user_args => null,
     p_session => p_session);
     /*put the message(like 'Updated one master record' ) back in the screen*/
     p_session.set_value(p_block_name => 'MASTER_BLOCK',
     p_attribute_name => '_STATUS',
     p_value => l_msg);
     p_session.save_session();
END IF;
END;

Similar Messages

  • Problems with Master-Detail Form not retrieving Detail Rows

    Portal 3.0.7.6.2 on NT
    I am having problems with a Master-Detail Form not retrieving Detail Rows. Sometimes it retrieves all, sometimes about 50%, the majority of the time it's not retrieving any. If it never retrieved any I would suspect that the 'join' condition was wrong but that isn't the case. I didn't have this problem with a prior MD Form I created. I have tried re-creating the MD Form but I get the same problem.
    Is anyone having similar problems/is this a know bug??
    Any help or thoughts are appreciated.

    I experienced performance problems. The simpiest MD form takes about 10 secs. to requery. I's not answer to your question, but there is more problems with this concept.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Michael Finch ([email protected]):
    Portal 3.0.7.6.2 on NT
    I am having problems with a Master-Detail Form not retrieving Detail Rows. Sometimes it retrieves all, sometimes about 50%, the majority of the time it's not retrieving any. If it never retrieved any I would suspect that the 'join' condition was wrong but that isn't the case. I didn't have this problem with a prior MD Form I created. I have tried re-creating the MD Form but I get the same problem.
    Is anyone having similar problems/is this a know bug??
    Any help or thoughts are appreciated.<HR></BLOCKQUOTE>
    null

  • Unable to View records in a master-detail form

    In a master-detail form, I am not able to view records of the master/detail table
    by accepting the values of the PK of the header table items.
    Please tell me the exact steps, so that I can view the detail table records based on the header table PK items.
    Thanks.

    Yes I wrote the LOV code in a different procedure. Now, the view is showing correctly. But I am now trying to update the viewed records.
    The steps I am following in View Option is as below:
    go_block('header');
    clear_block(no_validate);
    execute_query;
    proc_lov;
    go_block('item');
    execute_query;
    I am unable to commit the changes made in the blocks
    The reason it is showing is : UNABLE TO update.....I saw the display_error.
    The system is trying to update the PK part also..Why....Though PK party is clearly defined in the table as well as property palette. Pl. explain how to go about it. Uregent help is required once again.

  • To attach a RTF template(Report for printing ) in the master detail form

    I have an application in which I have 3  master detail forms  of which one of the form is a gate pass form . Now this gate pass form has a report region as the detail.
    All that i need help is to print the Gate Pass with few fields as information in the gate pass form , where an image or picture of the visitor is also a filed .
    Now I have created an RTF Template  which is the Gate pass layout with the pic.
    So ultimately I have the application for the gate pass form and the RTF template ready with me .. Fixing this template with the application with a BUTTON called PRINT is the challenge am facing !
    SELECT XVH.GPDATE
           , TO_CHAR(XVH.VISITORTIMEIN, 'HH:MI') VISITORTIMEIN --, (XVH.VISITORTIMEIN )
           , (TO_CHAR(XVH.VISITORTIMEOUT, 'HH:MI'))VISITORTIMEOUT
           , XVH.VISITOR_NAME --, = XVH.PERSON_ID
           , XVH.COMAPANY_NAME
           , XVH.PURPOSE_OF_VISIT
           , (SELECT A.FULL_NAME
                FROM PER_ALL_PEOPLE_F A
               WHERE A.PERSON_ID = XVH.PERSON_ID
                 AND SYSDATE BETWEEN A.EFFECTIVE_START_DATE AND A.EFFECTIVE_END_DATE) To_meet
           , XVH.VISITOR_PHONE
           ,APPS.GETBASE64 (XVH.VISITOR_PHOTO)
      FROM xxcdot.XXBCT_VGPF_HEADER XVH
    WHERE XVH.GP_HEADER_ID =  :P_HEADER_ID
    This is the query for the template ..
    Please help me with this. I am very new to apex and learning it with help of online tut

    Pars I need another Help
    I am working with a master detail form where in the form region i have a Radio group . Lets say the Radio group is
    o Returnable
    o Non Returnable
    o Other
    so when i select Non returnable I want a particular column called
    Line Status to get Disabled .
    I have done that by a dynamic action - using jquery statement (.Disable) .
    Defining the element attributes as Disable .
    Now the problem is that ,, Line status is getting disabled on the selection of Non returnable radio button. but unless and until i dont press the Add row button it does not work ,, else i will have to switch over between the radio buttons to get this action done !!

  • Adding button to report to link to master detail form

    I want to add a button to a report to direct me to a blank master detail form to insert a new record. I have used the following code in the additional PL/SQL code section:
    htp.formopen('PORTAL30.wwa_app_module.new_instance?p_moduleid=1271601405');
    htp.formsubmit('p_request','Create New');
    htp.formClose;
    When I click this I get 'Page Not Found'.
    But if I hit refresh I am directed to the correct form with the same url.
    Any ideas on what the issue is?
    Thanks.

    Hi,
    Check this sample code.
    tables:sscrfields. "Fields on selection screens
    selection-screen function key 1.
    selection-screen function key 2.
    Initialization.
      sscrfields-functxt_01 = 'Report'.
      sscrfields-functxt_02 = 'Exit'.
    at selection-screen.
       if sscrfields-ucomm = 'FC01'.
      perform f_alv_sub.
       elseif sscrfields-ucomm = 'FC02'.
       endif.
    Hope it helps.

  • Search on Master Detail form/report

    Hi,
    I noticed that when I created a new application in Apex 4.01 basing the intial page on a Master Detail form/report, I was able to add a search item to the initial page. When I go to add another page with a different Master detail form/report, I did not have any option for adding a search item to the report page. Seems like an oversight?
    I would appreciate any hints as to how to add same search item to my 2nd Master/Detail form/report.
    Thanks,
    Pat

    Me too facing the some problem can some one pls help

  • Parameter on Master Detail Form

    How do I set a bind variable in a Master Detail Form?

    I suspect that he may have the same question I do. Namely, if I have four tables (employees, projects, tasks, and project_assignments) how do I create a master detail form where I can specify the project and the employee via LOVs? The project_assignments table contains foreign keys for employee, project, and task, as well as additional fields relating to the task status.
    Currently, I have it set up so that the employee name can be selected and the project is hard coded to the current project.
    Is there an easy way to populate the detail records based on two LOVs in the master form?
    Thanks in advance,
    Fritz

  • Master Detail Form - unable to add detail row

    Dear,
    I have a test application that runs for years on apex.oracle.com.
    Since 3rd of june 2010 I am unable to add rows on a detail form.
    Any ideas?
    Help is welcome!
    Kind regards
    Lorenz

    4.0 Conversion Issue
    Lorenz stated I can create the orderheader, but unable to create orderlines.Simply nothing happens, when I click the add row button.>
    I share the same issue as Lorenz, on a Master/Detail form, I am able to create my Master row and but nothing happens when attempting to create detail rows. I was able to switch my application to theme 13 (Traditional Blue) from 2 (Blue and Tan) and was then able to create and add details rows.
    My dilemma. When switching to theme 13 and others, none appear to support Two Level Tabs in the same manner as Theme 2. Essentially the applications look and feel is not going to go over well with my user base of 3+ years.
    Is there another standard theme that will support Two Level Tabs like Theme 2 and allow the addition of detail rows on a Master/Detail form?
    Is this a reported 4.0 conversion issue?
    Jeff

  • Master Detail Form - How 2 update a field in the Detail form using a query?

    Hello,
    I have a master detail form with, each master record having a fixed(6) number of detail records. One of the fields in the detail record is the PART_DESCRIPTION field. I am trying to update this field by querying Table_X. TABLE_X is in the format of (desciption id, description). Description id runs from 1 to 6.
    When the form displays, the PART_DESCRIPTION field for the 6 detail records needs to be automatically populated with the six values of description stored in Table_X. How can this be done?
    Tried using session storage objects, but made no headway.
    Would greatly appreciate pointers on how to go about doing this.
    Thanks.
    Dev

    If you are on a Portal Version lesser than 3.0.9.8.3, then please try the following to populate
    the PART_DESCRIPTION field.
    Steps:-
    1> Edit the form and go to the Additional PL/SQl section and put the following code in the
    "...after displaying the page area" :-
    declare
    type t_vc_arr is table of varchar2(4000) index by binary_integer;
    l_arr_desc t_vc_arr;
    l_form_name varchar2(200);
    l_form_state varchar2(500);
    begin
    l_form_name := p_session.get_module().get_name();
    l_form_state := p_session.get_value_as_varchar2(
    p_block_name => 'MASTER_BLOCK',
    p_attribute_name => '_FORM_STATE'
    if l_form_state = 'QUERY_AND_SAVE' then
    select description
    bulk collect into l_arr_desc
    from <schema>.table_x;
    htp.p('
    <script>
    var descArr = new Array();
    var Fidx = 1;
    var formObj = document.WWVM'||p_session.get_id()||';
    var fieldName = "'||l_form_name||'.DETAIL_BLOCK.PART_DESCRIPTION.0";
    for i in 1..l_arr_desc.count loop
    htp.p('descArr['||to_char(i-1)||']="'||l_arr_desc(i)||'";');
    end loop;
    htp.p('
    for (var i=0; i < formObj.length; i++){
    if (formObj.elements.name == fieldName+Fidx){
    formObj.elements[i].value = descArr[Fidx-1];
    ++Fidx;
    htp.p('</script>');
    end if;
    end;

  • How to create Insert & Update on master-detail form JPA/EJB 3.0

    Is there any demonstration or tips how to Insert record on master-details form for JPA/EJB 3.0 with ADF binding?

    I have master-detail forms (dept-emp). I drag the dept->operations->create method to JSF page. But when I click create button, only dept form is clear and ready for insert. But emp form is not clear. How can I add create method for this?
    Can you give some example how to pass the right object to the persist or merge method so that it can save both the two objects (master-detail tables)
    Thanks
    Edited by: user560557 on Oct 9, 2009 8:58 AM

  • Portal Master-detail form how to auto assign detail record sequence number

    Portal Master-detail form how to auto assign detail record sequence number.Please help me?

    You can just read the following section
    Can I specify a sequence number generator as the default value for a form column?
    Yes. Enter the following in the "default value" field for the column:
    #<schema name>.<sequence name>.nextval
    where <schema name> is the name of the schema containing the sequence, and <sequence name> is the name of the sequence. The entry is preceded by a "#".
    For example, if the schema name is "SCOTT", and the sequence name is "CUSTOMER_SEQ", the default value entry is:
    #SCOTT.CUSTOMER_SEQ.NEXTVAL
    same way you can do for master - detail form.
    for more information on forms please refer the following URL.
    http://otn.oracle.com/products/iportal/htdocs/portal_faq.htm#BuildingApplications
    hope it helps.

  • Master-Detail Form (How to pass an item value in Master to Detail field

    I have a Master-Detail form. When adding a new record in the Detail section, I expect the primary key in the master record will copy down to the detail record. But, it is not doing that. Does anyone know how to pass the master primary key down to the detail record field.
    By the way, query works fine. It knows the master-detail relationship. It is just when creating a new detail record, the key not pass down from the master record.
    thanks - Patty

    hi,you can do it by:in detail form's foreign key field,set it's default value as master primary key ,example master page p1,primary key as p1_master,detail form p2,foreign key p2_foreign, set p2_foreign key 's default value &p1_master.
    Message was edited by:
    lixinzhu

  • Many to many master detail form

    Hi All,
    APEX 3.1.2 on SuSE 10 Oracle 10.2.0.3 64 bit
    I am new to APEX, but used OAS several years ago. Back then I hardcoded all htp.print commands. We are building an intra-team application to track system relationships. For example,
    web interface 3 --> application server 2 --> database 6
    Our tables are similar to the following
    SYSTEMS
    system_id (unique sequence)
    system_type_id (database, app server, apache, etc.)
    SYSTEM_TO_SYSTEM
    publishing_system_id - number
    consuming_system_id - number
    We would like to have a master detail form where we would query database 6 for example, and then see all related systems one level below it (application server 2 in the example above). I have been able to query the related systems and show them in a drop down pick list on the detail form, but I cannot edit them.
    The wizard asked for the primary key of the detail table, which in this case is not a sequence generated value, but a pick from a systems table lookup on system_id/system_name.
    If the master form would automagically lass the system_id to the publishing_system_id on the detail form, and allow me to update that with a picked system_id tied to consuming_system_id, that would be perfect.
    I can write the htp calls I mentioned earlier, but I am sure I am missing something.
    Does anyone have any best practices for this?
    Thanks!
    Steve

    Hi Steve,
    Here is an example which might help you:
    http://apex.oracle.com/pls/otn/f?p=43368:35
    Here, I have used two tables e.g. test1 and test2. Test1 has an id column which is just a sequence column and the name column in this table has a unique key.
    Table test2 has id column as primary key and name1 column is linked with Test1 table on the Form. Name2 column is not required to be linked with Test1 table.
    If this is what you are after, then I can give your more detail for it.
    Hope it helps.
    Zahid

  • Is this a bug? master rowid value lost when saving on a master/detail form

    master/detail forms seem to lose the rowid after saving, if the unique identifier is set to ROWID
    to reproduce the problem:
    1) create a master detail form on DEPT/EMP
    -- choose 'Managed by Database (ROWID)' on the 'Define Primary Key' page.
    -- do not include master row navigation (but i don't think this matters)
    -- choose 'Edit detail as tabular form on same page' on the 'Choose Layout' page
    -- include the master report
    2) on the master/detail page, change the conditional branch that returns to the master report page
    -- the normal condition for this branch is request in SAVE,DELETE,CREATE
    -- change it to request in DELETE,CREATE
    3) run the form and save a change
    -- saves fine, session shows the ROWID value is still set
    4) save a second change
    -- change does not save, form reverts to Create mode
    this problem does not occur when using the primary key columns instead of rowid
    see http://apex.oracle.com/pls/apex/f?p=60813:7 for the ROWID version
    see http://apex.oracle.com/pls/apex/f?p=60813:11 for the PK column version

    Hi Saverio,
    Bug *13563808* has been logged to track the reported issue, and a fix will be made available in a future release. Just to clarify, this issue is only arising when the APEX-generated Master-Detail is modified post-generation, so for users who have not modified their Master-Details using ROWID to manage their DML processes, they should not experience this issue.
    In relation to my workaround, my suggestion works in my test environment, which I verified before posting the initial suggestion. Please note that the 'Reset Page' process is, by default, conditional on the "Delete" button being pressed. If you have made further modifications to your Master-Detail page, then this might explain why you're seeing different behaviour to me. You might using the "Debug" option on the Developer Toolbar useful. Viewing the debug information should help you to decipher what's going on/wrong on your page. If you still can't resolve the issue, then the safest option might be to revert the page back to it's original state, meaning the user navigates back to the Report page upon submitting changes to the Master-Detail Form page.
    Regards,
    Hilary

  • Error while creating the master-detail forms

    on creation of a new master-detail form or on edit of a existing master-detail form, i get the following error -
    ******** START ERROR **********
    Thu, 15 Mar 2001 23:02:16 GMT
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "CC_INTRANET.WWV_BIND", line 56
    ORA-06512: at "CC_INTRANET.WWV_UI_LOVF", line 3123
    ORA-06512: at "CC_INTRANET.WWV_UIFORM_BUILD", line 2850
    ORA-06512: at "CC_INTRANET.WWV_UIFORM_BUILD", line 5567
    ORA-06512: at line 8
    DAD name: cc_intranet
    PROCEDURE : CC_INTRANET.wwv_uiform_build.show_header
    URL : http://webdb.us.colorcon.com:7777/pls/cc_intranet/CC_INTRANET.wwv_uiform_build.show_header?p_wizard_mode=MASTER&
    ********** END ERROR ********
    any ideas anyone ... ?
    thanx in advance ...
    null

    more information on above -
    i upgraded webdb 2.2 to portal 3.0.6 and the new master-detail form is been created in the upgraded site.
    pls reply on this.
    thanx a bunch
    null

Maybe you are looking for

  • ITunes 11.3.1.8 cannot delete playlist Windows 7 64-bit

    I have been importing CD's and I created a few playlists. Now, I want to delete some playlists and iTunes only crashes EVERY TIME.I tried a Repair Install, but that didn't help. Here's what I'm doing: 1.     Display playlists. 2.     Select playlist

  • Angry with itunes10. will no longer purchase songs from itunes.

    I have bought so many songs off itunes It won't let me burn any of them onto a cd since updating to itunes10 So i try putting it own windows media player. it won't let me do that. So then i try burning it on a cd it won't let me do that either. I've

  • Adding features to the remote

    First, I really like both the remote, and the description included with the remote, while improvements might be made, they are examples of the best available.  I have 1 problem with the remote, and I wonder if it might be possible to get one addition

  • Debit Invoice split, based on split analysis refering to payment reference in header

    Hello Experts, When debit memo request process for billing through SDBILDL due list job, debit invoice split and when I check in silt analysis it is referring to payment reference for split criteria and both the invoice carries same payment terms fro

  • Synchronisation failure, cannot find the file ?

    Cannot synchronise iPhone an iPads witth mij Mac THE iMac reports that it can 'tfind the file for this