7 Replies Latest reply: May 8, 2014 9:50 AM by Yong Huang RSS

    Master and detail page update one time

    Yong Huang

      apex 4.1

      oracle 11g

       

      Hi all,

       

      I know many people have posted this thread, but I wonder why the detail can be updated when master primary key have no key.

       

      I have created the example at OTN

      workspace: susanhuang

      username: TURTOR

      password: TURTOR

      application: sue_huangyong@126.com   76130

      page7

       

      master table: dept  detail table: emp

       

      I have created the process like the following

       

      for i in 1.. apex_application.g_f03.count

          loop

            apex_application.g_f03(i) := :P7_DEPTNO;

          end loop;

       

      Updated the APPLYMRU as below

       

      :request like ('SAVE') or :request like 'GET_NEXT%' or :request like 'GET_PREV%' or :request like ('CREATE')

       

      but it didn't work, and I know why, because when P7_DEPTNO have no value when execute applymru process, so the detail form cannot be saved.

       

      anybody help me that how to get the primary key value

       

      thanks and regards

        • 1. Re: Master and detail page update one time
          scott.wesley

          Try modify "Process row of DEPT", set 'Return key into item' as "P7_DEPTNO"

          • 2. Re: Master and detail page update one time
            Yong Huang

            Hi Scott,

             

            thanks for your responding.

             

            I checked the process row of DEPT, and "Return key into item' is already P7_DEPTNO.

             

            please login my OTN application as thread mentioned to check what is wrong if possible.

             

            thanks and regards

            • 3. Re: Master and detail page update one time
              scott.wesley

              I set the value for you, just in case you couldn't find what I meant - I left it for you to test it.

              • 4. Re: Master and detail page update one time
                Yong Huang

                Hi Scott,

                thanks for your update.

                I tested it and no any changes, still cannot save the detail form.

                Are you sure it works?

                 

                thanks and regards

                • 5. Re: Master and detail page update one time
                  Yong Huang

                  Hi Scott,

                   

                  I can't tell what you changed at my application, could you correct it directly?

                   

                  Or

                  Anybody could help me?

                  • 6. Re: Master and detail page update one time
                    Yong Huang

                    According to view debug, I found the primary key item has a value, but seems apex_application.g_f01(i) have no got the value.

                     

                    for i in 1.. apex_application.g_f01.count

                        loop

                          apex_application.g_f01(i) := :P7_DEPTNO;

                        end loop;

                     

                     

                    please reference the debug information:

                     

                     

                    0.041490.00005Processes - point: AFTER_SUBMIT4
                    0

                     

                    0.041540.00156...Process "Process Row of DEPT" - Type: DML_PROCESS_ROW4

                    5

                    0.043100.03413...Execute Statement: begin begin insert into "HUANG"."DEPT" ( "DNAME","LOC") values (:DML_BV0001,:DML_BV0002) returning rowid, "DEPTNO" into wwv_flow.g_dml_rowid, wwv_flow.g_return_key_1; end; end;4

                    100

                    0.077230.00010...Session State: Saved Item "P7_DEPTNO" New Value="330"4

                    0

                    0.077320.00016...Process "PassID" - Type: PLSQL4

                    0

                    0.077490.00822...Execute Statement: begin APEX_DEBUG_MESSAGE.LOG_MESSAGE('F01: '|| apex_application.g_f01.count); for i in 1.. apex_application.g_f01.count loop apex_application.g_f01(i) := :P7_DEPTNO; end loop; end;4

                    24

                    0.085710.00013...Process "ApplyMRU" - Type: MULTI_ROW_UPDATE4

                    0

                    0.085840.00180...Execute Statement: begin wwv_flow.g_boolean := :request like ('CREATE') or :request like ('SAVE'); end;4

                    5

                    0.087640.00897......Result = true4

                    26

                    0.096600.01242......Row 1: insert into "HUANG"."EMP" ( "EMPNO", "DEPTNO", "ENAME", "JOB") values ( :b1, :b2, :b3, :b4)4

                    36

                    0.109030.00009...Process "ApplyMRD" - Type: MULTI_ROW_DELETE4

                    0

                    0.109110.00005......Skip because condition or authorization evaluates to FALSE4

                    0

                    0.109160.00024...Process "reset page" - Type: CLEAR_CACHE_FOR_PAGES4

                    1

                    0.109400.00004......Skip because "When Button Pressed" doesn't match with REQUEST4

                    0

                    0.109450.00004Branch point: After Processing4

                    0

                    0.109490.00014...Evaluating Branch: "AFTER_PROCESSING" Type: REDIRECT_URL Button: 45959281827157149126 Condition: (Unconditional)4

                    0

                    0.109630.00016...Evaluating Branch: "AFTER_PROCESSING" Type: REDIRECT_URL Button: 45959281918354149126 Condition: (Unconditional)4

                    0

                    0.109790.00112...Evaluating Branch: "AFTER_PROCESSING" Type: REDIRECT_URL Button: (No Button Pressed) Condition: SAVE,DELETE,CREATE4

                    3

                    0.110910.00017Redirecting to f?p=76130:6:119435471500648:::::&success_msg=Action%20Processed.0%20row(s)%20updated%2C%201%20row(s)%20inserted.%2FC059BF2BC49F8B0CEAA127AF1AB1E9A4%2F4

                    0

                    0.111070.00011Stop APEX Engine detected4

                    0

                    0.111180.00009Stop APEX Engine detected4

                    0

                    0.11127-Final commit4-

                     

                    And the source of detail form is the following

                    select

                    "EMPNO",

                    APEX_ITEM.TEXT(1,"DEPTNO") "DEPTNO", "ENAME",

                    "JOB"

                    from "#OWNER#"."EMP"

                    where "DEPTNO" = :P7_DEPTNO

                     

                    It's strange, I can tell P7_DEPTNO got the new value, and process PASSID and APPLYMRU have been executed, but the DEPTNO didn't be saved. that make me crazy.

                     

                    Looking forward to someone's help.

                     

                    Thanks & Regards

                    • 7. Re: Master and detail page update one time
                      Yong Huang

                      God, I finally know where I am wrong.

                       

                      For the tabular table, the apex_item has been embedded, so don't need define that again, so I changed the source of detail form as usual, which means remove the content apex_item(1,"DEPTNO").

                       

                      Then changed the process for saving the primary key value as below:

                      for i in 1.. apex_application.g_f03.count

                          loop

                            apex_application.g_f02(i) := :P7_DEPTNO;

                          end loop;

                      Important:

                      what g_f03.count means the 3rd column must have value, determine how many rows are there in detail form.

                      what g_f02(i) means the 2nd column is where the master primary key is.

                       

                      and it works.