Primary key updation in the Master details form.

Hi All,
I am struggling with Master Detail form in apex 3.12.
I have two tables.
SaleMaster ( TRN_ID as PK ) Created from Sequence.
SaleDetail ( TRN_ID , TRN_TYPE as PK) TRN_ID FK from SaleMaster , TRN Type is user Input in SaleDetail.
What is best simple way to create the master details form for the above master details tables.
Thanks.

I found a way. I dont like it - but it works.
I made a column link in the detail with the following:
javascript: doSubmit('NAVIGATE@#ROWNUM#);
This way I obtain information in the :REQUEST object about which row was clicked.
In a After submit process on the page I then parse this :REQUEST object like this:
DECLARE
v_row NUMBER;
v_pos NUMBER;
BEGIN
v_pos := instr(:REQUEST,'@',-1);
v_row := substr(:REQUEST, v_pos+1);
IF APEX_Application.g_f02(v_row) IS NOT NULL THEN
:P_PRIMARY_KEY_ID:= APEX_Application.g_f02(v_row);
ELSE
:P_PRIMARY_KEY_ID:= -1;
END IF;
END;
I know that my "Id" column is named f02 in the form, so this way I can find the id. I then assign this id to a kind of global variable - on the page I redirected to I can now find the Id.
Talk about ugly code :P

Similar Messages

  • More than one Detail table in the Master Detail forms!

    Hi,
    I need to have more than one Detail table in Master Detail Forms.
    I want to see the details of the rows of the first Detail table in the Second Detail table. Please guide me to do this.
    Sincerely yours,
    Mozhdeh

    You can do one of two things
    1) Depends on the nature of your data model. I was able to manage many to many
    relationships using views and instead of triggers. This solution is somewhat complex but can work in certain situations.
    2)Works for situations where master record exists. create a page with mulitple portlets syncronized on some related key.
    create the following package to use on the md forms to place on the one page to be rendered.
    -- this package will facilitate the storage and retrieval of keys used by the related forms.
    create or replace package session_var
    IS
    session_parms portal30.wwsto_api_session;
    g_domain varchar2(2000) := portal30.wwctx_api.get_user;
    function get_id (id in varchar2) return number;
    PROCEDURE SET_ID
    (ID in VARCHAR2
    ,p_val in VARCHAR2
    ,P_URL in VARCHAR2
    END SESSION_VAR;
    create or replace package body session_var
    IS
    --pkg body
    function get_id(id in varchar2) return number is
    l_store_session portal30.wwsto_api_session;
    l_id number;
    begin
    l_store_session := portal30.wwsto_api_session.load_session(
    p_domain => session_var.g_domain,
    p_sub_domain => 'your domain');
    l_id := l_store_session.get_attribute_as_varchar2( p_name => id);
    return l_id;
    end get_id;
    PROCEDURE SET_ID
    (ID in VARCHAR2
    ,p_val in VARCHAR2
    ,P_URL in VARCHAR2
    IS
    l_store_session portal30.wwsto_api_session;
    begin
    l_store_session := portal30.wwsto_api_session.load_session(
    p_domain => session_var.g_domain,
    p_sub_domain => 'your domain');
    l_store_session.set_attribute(
    p_name => id,
    p_value => p_val );
    l_store_session.save_session;
    * Redirect to the page using p_url;
    portal30.wwv_redirect.url(P_URL);
    end set_id;
    END SESSION_VAR;
    --the form master detail form, section  before display page enter the following code and publish as portlet.
    declare
    l_fs varchar2(4000);
    l_s varchar2(4000);
    v_con_id number;
    begin
    v_con_id :=rfq.session_var.get_id('CON_ID'); -- primary key and key used to relate details
    p_session.set_shadow_value( p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'A_CON_ID', -- attribute on form related to primary key
    p_value => '= '|| v_con_id,
    p_language => portal30.wwctx_api.get_nls_language ,
                   p_index => 1
    l_fs := p_session.get_value_as_varchar2(p_block_name => 'MASTER_BLOCK', p_attribute_name => '_FORM_STATE');
    l_s := p_session.get_value_as_varchar2(p_block_name => 'MASTER_BLOCK', p_attribute_name => '_STATUS');
    if l_fs = 'SAVE' and l_s is null then
    WWV_MASTER_GENSYS_1(p_block_name => p_block_name,
    p_object_name => p_object_name,
    p_instance => p_instance,
    p_event_type => p_event_type,
    p_user_args => p_user_args,
    p_session => p_session);
    p_session.save_session;
    end if;
    if l_fs = 'QUERY_AND_SAVE' and l_s is null then
    WWV_MASTER_GENSYS_1(p_block_name => p_block_name,
    p_object_name => p_object_name,
    p_instance => p_instance,
    p_event_type => p_event_type,
    p_user_args => p_user_args,
    p_session => p_session);
    p_session.save_session;
    end if;
    exception
    when others then
    PORTAL30.wwerr_api_error.add(PORTAL30.wwerr_api_error.DOMAIN_WWV,'app','generic','onLink', p1 => sqlerrm);
    raise;
    end;
    --then create other md forms and publish as portlets in a similar manner.
    -- create a form (form_session_vars) to call procedure session_vars and place the following code in the
    addiontional pl/sql tab
    WWV_GENSYS_1(
    p_block_name => p_block_name ,
    p_object_name => p_object_name,
    p_instance => p_instance ,
    p_event_type => p_event_type ,
    p_user_args => p_user_args ,
    p_session => p_session);
    --then create a page and place the md forms created above as portlets on the page.
    --create a link and target the form_session_vars and in the link target inputs
    enter the values for your user parameters
    id= CON_ID --"your primary key name"
    p_url= url/page/"your_page"
    --finally create a report (QBE or standard).
    in the column formation section use the link created earlier to direct the user to the target page.
    How it works.
    When the link is selected the form_session_Var is called and automatically runs setting the primary key values
    in the user session store. The step is required or the resulting page will not render properly. Then the user is redirected to the page where the portlets are rendered. The portlets start rendering, the before display page calls the session vars package to retrieve the key and put the form into query_update mode returning the data.
    The portlets finish in query_and_save mode with details in update mode, the allowable insert, delete and none actions will be available for the details.
    benefits: The session_Var package code is resuable as well as the form form_session_Var and the link. passing the key name and values are done at the report level and detailed in the report links. the md forms will need to reference their related keys.

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

  • 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

  • Updating columns in master/detail form

    Changes were made to the database that is in the master part of a master/detail form. I have tried to add the new fields using "Create Item" on the page definition.
    I have gone through the wizard and set the source items to:
    Source Used: Always
    Source Type: Database Column
    Session State: per session
    Source Value: AppsDependentOn (the name of the newly added field)
    It seems that the form will not display the new column - it does display the label and a blank textfield. I have no problem adding columns to the detail part of the form.

    "197331",
    For Source Value, try uppercase instead: APPSDEPENDENTON
    Sergio

  • Problems referencing a primary key field in a master-detail

    Hello,
    I am making an application where I have a master-detail page.
    In the detail section it is possible to add new rows using the standard "Add row"-button that the wizard creates.
    The detail section has a column with a link in it. This link leads to another part of the application.
    When I press this link I would like to send the field "Id" of the current detail row to the page which the link redirects to.
    So far I have concluded that the primary key field "Id" of the detail is only filled out after I do a submit. So I have my column link set up to do:
    javascript: doSubmit('NAVIGATE_1');
    In the branching I am testing on the :REQUEST object to see if it contains 'NAVIGATE_1' - I can't seem to get the value from the "Id" field though. I tried to add #ID# in the javascript submit call - but since the "Id" is filled only after I submitted then this doesnt really work at all.
    Does anyone have an idea on how to make this work in APEX ? Its probably some simple thing that I just didnt think of yet ;)
    Kind regards
    Bo Normann

    I found a way. I dont like it - but it works.
    I made a column link in the detail with the following:
    javascript: doSubmit('NAVIGATE@#ROWNUM#);
    This way I obtain information in the :REQUEST object about which row was clicked.
    In a After submit process on the page I then parse this :REQUEST object like this:
    DECLARE
    v_row NUMBER;
    v_pos NUMBER;
    BEGIN
    v_pos := instr(:REQUEST,'@',-1);
    v_row := substr(:REQUEST, v_pos+1);
    IF APEX_Application.g_f02(v_row) IS NOT NULL THEN
    :P_PRIMARY_KEY_ID:= APEX_Application.g_f02(v_row);
    ELSE
    :P_PRIMARY_KEY_ID:= -1;
    END IF;
    END;
    I know that my "Id" column is named f02 in the form, so this way I can find the id. I then assign this id to a kind of global variable - on the page I redirected to I can now find the Id.
    Talk about ugly code :P

  • Issues in Processing the Master-Detail Form values

    We have a requirement in Oracle Internet Expenses (11.5.10) to fetch the form values from the Expense Allocations Screen.
    This page is based on Multiple VOs with Master Detail relationship. The data from the VOs mentioned are displayed in the Hgrid region.
    I need to fetch the input values for three fields (from different VOs) and pass them as paramater to the database function to perform the validation.
    Here, I am creating the handle for VO objects and using the Row object getting all rows in range (getAllRowsinRange()).
    The issue here is always, the Row length() is always fetched as 1 even it has multiple rows.
    Any help on this would be highly appreciated.

    Using Select Options u will get mulitiple values also u will get values like table.
    regards,
    kumar.

  • Master Detail Forms with 2 composite primary keys - Is there a workaround?

    Hello All,
    I have been searching for a workaround to the maximum 2 part primary key restriction on the multi-row updates, and master-detail forms, and am hoping that someone can help me. I am using HTMLDB v2.0.0.00.49 with IE 6 against a 9.2 DB.
    I successfully implemented the workaround of Fred Stoopendaal's (see Updata PK on HTML DB ) and it works fine for single page multi-record updateable forms, but alas I haven't been able to extend it to master detail forms (I think it is something to do with Oracle not allowing the "returning" clause on views).
    Here is what I tried:
    two tables, one with a 2 part composite primary key, which is the master table, and a detail table with 3 part composite primary key -
    --------- BEGIN SQL ---------
    create table master_table
    ( master_col1 number
    , master_col2 number
    , master_col3 varchar2(30)
    , constraint master_pk primary key (master_col1,master_col2));
    create table detail_table
    (detail_col1 number
    ,detail_col2 number
    ,detail_col3 number
    ,detail_col4 varchar2(30)
    , constraint detail_pk primary key(detail_col1,detail_col2,detail_col3)
    , constraint master_detail_fk foreign key (detail_col1,detail_col2) references master_table(master_col1,master_col2));
    create or replace view v_master_table as
    select rowid mata_rowid,mata.*
    from master_table mata;
    create or replace view v_detail_table as
    select rowid deta_rowid,
    (select rowid from master_table mata where mata.master_col1 = deta.detail_col1 and mata.master_col2 = deta.detail_col2) deta_mata_rowid
    , deta.*
    from detail_table deta;
    create or replace trigger mata_ins_upd_trg
    instead of insert or update on v_master_table
    referencing new as new old as old
    for each row
    begin
    if inserting then
    insert into master_table (master_col1, master_col2, master_col3)
    values (:new.master_col1, :new.master_col2, :new.master_col3);
    end if;
    if updating then
    update master_table
    set master_col1 = :new.master_col1,
    master_col2 = :new.master_col2,
    master_col3 = :new.master_col3
    where rowid = :old.mata_rowid;
    end if;
    end;
    create or replace trigger deta_ins_upd_trg
    instead of insert or update on v_detail_table
    referencing new as new old as old
    for each row
    begin
    if inserting then
    insert into detail_table ( detail_col1, detail_col2, detail_col3, detail_col4)
    values (:new.detail_col1, :new.detail_col2, :new.detail_col3, :new.detail_col4);
    end if;
    if updating then
    update detail_table
    set detail_col1 = :new.detail_col1,
    detail_col2 = :new.detail_col2,
    detail_col3 = :new.detail_col3,
    detail_col4 = :new.detail_col4
    where rowid = :old.deta_rowid;
    end if;
    end;
    --------- END SQL ---------
    Then I created a master-detail form in Apex on the two views, using the mata_rowid and deta_rowid as primary keys, and mata_rowid=deta_mata_rowid as the link. I realise that using a function to fetch the master rowid within the detail view query is costly, but it was my intention to modify the record fetch queries to use the real FK columns once things were up and running.
    It seems to generate the pages ok, and I can insert/update master table records, but as soon as I modify records in the detail table things go a bit haywire. I can't find any documentation on how the inbuilt MRU/MRD logic works, so can't figure out the issue.
    Can anyone out there tell me what the problem is with the logic above, or if they have come up with a neat solution to this annoying limitation. I know that many will say that I should modify the data model to use surrogate primary keys, but many of the uses for HTMLDB are new interfaces for old schemas, so a workaround that doesn't involve wholesale data model changes would be preferable.
    Thanks in advance,
    Mike Cretan

    Hi, this is likely not the most elegant way...but perhaps the simplest -- and I didn't have much time to play.
    I used Wizard to create two separate Master Detail forms, each with a separate detail table. Thus I ended up with four pages:
    Page "A" - "Selector" page for Master (Report), with Edit link driving to Detail-1
    Page "B" - Editable Master/Detail-1 page (HTML / Report)
    Page "C" - "Selector" page for Master (Report), with Edit link driving to Detail-2
    Page "D" - Editable Master/Detail-2 page (HTML / Report)
    Then I selected the primary key column TWICE on the Report on Page A. Modified the second instance of this column to navigate to Page D (passing primary key) exactly the way the original instance of this column navigates to Page B. Then I deleted Page C.
    Since you can have only one Tabular Entry form per page, this seemed the best way to drive two separate detail tables from a common interface.

  • Primary key in master detail form

    i have a situation where i need to access the value of primary key (primary key is hidden) in a master-detail form.
    i need to access the primary key in the javascript onClick event of the button. i'm using the following code in the ...before displaying the form event :-
    htp.p('<script language="JavaScript1.3">
    <!--
    function getField(form,fieldName)
    var objName = "";
    var tmp = "";
    var dAction = "";
    var sel_idx = 0;
    var cnt = 0;
    var instance = 0;
    var slicedName;
    var fillData = new Array();
    for (var i = 0; i < form.length; i++)
    slicedName = form.elements.name.split(".");
    tmp = slicedName[2];
    instance = parseInt(slicedName[3],10);
    if (!tmp)
    continue;
    objName = tmp;
    if (objName == fieldName)
    return form.elements[i].value;
    //-->
    </script>');
    and then i'm calling this javascript in onClick event of the button as follows :
    var_get_val = getField(this.FORM,'PROD_ID');
    this script works for a form with single block but, does not work with the master detail form.
    what is wrong here ... ??
    any ideas or suggestions ...??
    thanx a lot.
    null

    Thank you, Denes,
    but isn_t there a simplier way to use a third column ?
    I will keep your idea in mind and try out as soon as possible.
    With kind regards,
    Hergen.

  • How to set the Master Action of a master detail form?

    Hi,
    I have a regular form navigates to a master detail form in
    insert mode. How do I make the MASTER_ACTION show up
    as "Insert" instead of "None"? If I call the Master detail form
    in auto query mode, it will show up as "Update" in the
    MASTER_ACTION. How do I make the MASTER_ACTION show up as
    "Insert" instead of "None"?
    Any ideas are highly appreciated.
    Thanks;
    Kelly.

    Just have a look over these two statements if it solves your problem
    one time where clause
    Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
    dynamic where clause
    set_block_property('BLOCK_NAME'default_where, your form itme)
    you can where clause at run time from any procedure or some triggers

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

  • 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

  • Insert error in master-detail form

    Probably a stupid question. When I populate the master block of
    a master detail form from an LOV, I am asked to save the form.
    Since the information is loaded from the LOV, there are no
    changes to save. If I answer yes, it gives an Insert error due
    to the primary key violation in the master block table. If I
    answer no, it opens the detail block and gives the correct
    information. The problem is that when I enter information into
    the detail block and try to save it, I get the same error
    message regarding the primary key violation in the master block.
    The form works fine if I do not populate the master block from
    the LOV (or from select statements in triggers). Any suggestions
    will be appreciated.
    LS

    Hi,
    Check for the form or block status.Looks like the status has
    changed.Thats why u r getting the message.If any of the base
    table item has changed then u will get such a message.Try
    working on this an check it out.
    Thanks
    Vinod

  • Error in Master Detail Form

    Hi All,
    i m getting the following error when i m creating a master entry ...
    ORA-06550: line 5, column 23: PL/SQL: ORA-02289: sequence does not exist ORA-06550: line 5, column 16: PL/SQL: SQL Statement ignored ORA-06550: line 8, column 16: PLS-00364: loop index variable 'C1' use is invalid ORA-06550: line 8, column 9: PL/SQL: Statement ignored
    but while creating the master detail form i had specified the corresponding sequences and they even exist in the DB.
    Please ! do help me .
    Thanks & Regards,
    Nandini Thakur.

    Hi ,
    Though u choose the schema name ...the sequence is not appended with the schema name .
    Example you are craeting the application in schema 1 and ur database objects are in schema 2.
    so while creating the Master detail form you will get the option of choosing the schema, but then also the sequence name is not appended (as this may be the problem or bug in apex) .
    so one needs to manually go and append the schema name.
    In master detail form one needs to append it
    1) Form of the Master ...the process called as get primary key there the sequence name should be appended
    ex:- myschema.seq
    2) another is the detail tabular form . here you need to good to the id hidden field and edit it , then in the source column append it with the myschema.seq.
    Regards,
    Nandini Thakur

  • Session storage errors in master-detail form

    hi,
    as the sequences do not work in master detail forms, i'm using session variables but the form does not compile and gives error.
    following is my code in the SAVE button of the master-detail form -
    declare
    new_prod_id number(10);
    begin
    select BPSIDEV.PRODUCT_ID_SEQ.NEXTVAL
    into new_prod_id
    from dual;
    p_session.set_value
    p_block_name => 'MASTER_BLOCK',
    p_attribute_name => 'A_PRODUCT_ID',
    p_value => new_prod_id
    doSave; -- This is generated code
    end;
    the action item values is as foloows -
    Master - INSERT
    Detail - INSERT
    am i missing here something ? or is anything wrong here ?? pls advise ...
    after the above changes the form would not compile at all.
    also how would i populate the the detail records with the foreign key ??
    thanx...
    null

    This problem is fixed in 3.0.8 release of Portal which will be available with the next release of iAS.
    Actuallty the fix is simple look at the generated package of EXAMPLE_MD_FORM from EXAMPLE_APP, onSave event handler looks like this:
    procedure onSave
    p_block_name in varchar2,
    p_object_name in varchar2,
    p_instance in integer,
    p_event_type in varchar2,
    p_user_args in varchar2,
    p_session in out WWV_30898.wwa_api_module_session
    is
    "_master_block" varchar2(30) := 'MASTER_BLOCK';
    Some more code.......
    And then closer to the end in detail processing section there is something like:
    "_d_data_rec".COMM:=p_session.get_value_as_NUMBER(
    p_block_name => "_detail_block",
    p_attribute_name => 'A_COMM',
    p_index => "_cnt"
    "_d_data_rec".DEPTNO:=p_session.get_value_as_NUMBER(
    p_block_name => "_detail_block",
    p_attribute_name => 'A_DEPTNO',
    p_index => "_cnt"
    ===========================================
    You'll need to insert following code, just one if statement, that's it. Please note every time you regenerate the package this code will be lost, so you'll need to add this agains and again. Not a perfect solution, that's why I like JS workaround better.
    ============================================
    if "_d_data_rec".DEPTNO is NULL and "_m_data_rec".DEPTNO is NOT NULL
    then
    "_d_data_rec".DEPTNO := "_m_data_rec".DEPTNO;
    end if;
    ============================================
    ============================================
    if "_detail_action" = 'DELETE' and "_DETAIL_ROWID" is not null then
    DELETE FROM WWV_30898_DEMO.EMP WHERE ROWID = "_DETAIL_ROWID";
    "_detail_deleted" := "_detail_deleted" + 1;
    elsif "_detail_action" = 'UPDATE' then
    UPDATE WWV_30898_DEMO.EMP SET EMPNO="_d_data_rec".EMPNO,ENAME="_d_data_rec".ENAME,JOB="_d_data_rec".JOB,MGR="_d_data_rec".MGR,HIREDATE="_d_data_rec".HIREDATE,SAL="_d_data_rec".SAL,COMM="_d_data_rec".COMM,DEPTNO ="_d_data_rec".DEPTNO WHERE ROWID = "_DETAIL_ROWID" ;
    "_detail_updated" := "_detail_updated" + 1;
    elsif "_detail_action" = 'INSERT' then
    INSERT INTO WWV_30898_DEMO.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES ("_d_data_rec".EMPNO,"_d_data_rec".ENAME,"_d_data_rec".JOB,"_d_data_rec".MGR,"_d_data_rec".HIREDATE,"_d_data_rec".SAL,"_d_data_rec".COMM,"_d_data_rec".DEPTNO) RETURNING ROWID INTO "_DETAIL_ROWID";
    "_detail_inserted" := "_detail_inserted" + 1;
    end if;
    ............................

Maybe you are looking for

  • IPhone 5 Suddenly not Recognized by iMac

    I have been using the same iPhone 5 with my iMac since I got the phone almost a year ago. I was away on business for a few weeks, and when I got back, plugging my phone into any USB port on the iMac (using the same cable I had used before), which use

  • How do I load only a few selected so

    I've been tring for the longest time to autosync only one or two songs and it always wants to autosync a whole playlist from the pc library or a playlist. I also have one more question about mp3 files that I recieved on a disk. When I double clik on

  • How to save stage as png interactively?

    Hi, Does anybody know how to save/export the stage as an image like in this example? http://ciruelo.jp/js/edge/tde.html Any help would be appreciated, thanks so much!

  • Getting the error while connection to SAP Server

    Hi,     I am getting the below mentioned error while connection to SAP Sever using SAP.Net Connector.   What could be the possible reason? "<i> <b>Connect to SAP gateway failed Connect_PM  GWHOST=ia2-ms.boi.hp.com, GWSERV=sapgw01, ASHOST=ia2-ms.boi.h

  • Album Starter Edition 3.0  has my pictures locked

    First time poster, new to on-line photos.  Recently we recieved blakcberry phones at work.  My pictures that I have been storing and backing up go automatically into Adobe Photoshop Album Starter Edition 3.0   I have been doing this for a about 6 mon