9 Replies Latest reply: Mar 28, 2013 1:18 AM by Gus C RSS

    Error Handling In 4.2

    Gus C
      In the oracle documentation on error handling, there is an example.
      In the example code it states
      -- Always show the error as inline error
              -- Note: If you have created manual tabular forms (using the package
              --       apex_item/htmldb_item in the SQL statement) you should still
              --       use "On error page" on that pages to avoid loosing entered data
              l_result.display_location := case
                                             when l_result.display_location = apex_error.c_on_error_page then apex_error.c_inline_in_notification
                                             else l_result.display_location
                                           end;
      What do I need to add to my code to set the error to dispaly on the error page, if the page is a manual tabular form ?
      Cheers

      Gus
        • 1. Re: Error Handling In 4.2
          Gus C
          Any ideas please

          Gus
          • 2. Re: Error Handling In 4.2
            Tom Petrus
            The answer is actually in that piece of code you quoted, although it always changes 'on error page' to 'inline'. Use
            l_result.display_location = apex_error.c_on_error_page 
            • 3. Re: Error Handling In 4.2
              Gus C
              Yes, the code will always change the error page in inline.
              My question is how do I code it, so that all manual tabular forms stay on the error page and do not change to inline.
              How can I determine whether the current page is a manual tabular for or not ?

              Gus
              • 4. Re: Error Handling In 4.2
                Nicolette
                Gus
                Gus C wrote:
                Yes, the code will always change the error page in inline.
                My question is how do I code it, so that all manual tabular forms stay on the error page and do not change to inline.
                How can I determine whether the current page is a manual tabular for or not ?
                That depends on how you would regonize a page as having a manual tabular form.
                Do the manual tabular forms have a template that only they use?
                Do the page that have a manual tabular form belong to a specific page group? And this page group has only pages with manual tabular forms.

                You could then build a select statement on the apex views to see if the current page has a manual tabular form.

                Other ideas
                * Use a apex item as flag that is set on page with a tabular form and cleared on pages with no tabular form.
                * Record the page id's in a separate table.
                * And as very very last resort hard code the page id's

                Personally I would go with information that can be found in the apex views. And the leasts the developer has to think about setting it the better the solution.
                But even setting a particular word in the comments of the region or page should work.

                Nicolette
                • 5. Re: Error Handling In 4.2
                  HeliosHyperion
                  You just have
                  • 6. Re: Error Handling In 4.2
                    Gus C
                    I don't have any page groups or special templates for manual tabular forms.
                    I tis also possible that pages without manual tabular forms have been set to display errors on the error page
                    Should I just do this
                    if v('app_page_id') in (2,3,4,5,6) -- these are pages with manaul tabular forms
                    then
                    l_result.display_location := apex_error.c_on_error_page
                    else
                     l_result.display_location := apex_error.c_inline_in_notification
                    end if;
                    or is there a better way.

                    Gus

                    Edited by: Gus C on Mar 27, 2013 3:36 AM
                    • 7. Re: Error Handling In 4.2
                      Nicolette
                      Gus

                      Just found that the page also has a error handling function attribute.
                      From the help "If specified on page level the error handling function specified on application level will be overwritten. "

                      If you have/create a second function that sets l_result.display_location := apex_error.c_on_error_page instead of l_result.display_location := apex_error.c_inline_in_notification.
                      And use that function on the pages that have a tabular form.

                      Or as already mentioned in my previous post use a particular word or group of words in the comments of a page. You would than use something like.
                      select pag.page_id
                      from   apex_application_pages pag
                      where  pag.page_id = :app_page_id
                      and    pag.application_id  = :app_id
                      and    pag.page_comment like '%manual tabular form%'
                      Or use a code in the name of the page.

                      What ever will work for you and your colleagues.

                      Nicolette
                      • 8. Re: Error Handling In 4.2
                        trent
                        I guess it depends how you want to figure out what is a manual tabular form page. I would hazard a guess you would use the process that the error is likely to occur from.

                        Since apex has more advanced tabular form processing now a days (no need to use the apex_application.g_f0x arrays), then you could define it as a page that has a process using apex_application.g_f0x array in the process. Although, this won't be a sure way so may not be relied upon (as described below)..

                        In saying that, it looks like t_error has an element of wwv_flow.t_component, which this post shows the attributes: {message:id=10571642}

                        - type
                        - id
                        - name

                        id seems to be the process id (At least when the type is: APEX_APPLICATION_PAGE_PROCESS). so:
                        if p_error.component.type = 'APEX_APPLICATION_PAGE_PROCESS' then
                        
                          select upper(PROCESS_SOURCE) into l_source
                          from apex_application_page_proc
                          where process_id = p_error.component.id;
                        
                          if instr(l_source, 'APEX_APPLICATION.G_F0') > 0 then
                          --we are referencing the array in the process that generated the error. There is a fairly good chance it is a manual tabular form page
                        
                            --SET error type to manual tabular form type
                        
                          end if;
                        
                        end if;
                        
                        --SET error type for everything else
                        Of course, there are lots of situations where you may be using the apex_application.g_f0x array that is not directly related to a manual tabular form (e.g. tabular form, hidden items on an sql report, etc). But I feel this is probably one of the better ways to check for a manual tabular form process. Also, with the available data in p_error, you could probably rule out other types - standard tabular form has a value in p_error.region_id whereas a manual tabular form will not.

                        There is one downside however - wwv_flow.t_component is not documented, and I guess could be subject to change (i've added a feature request with the following key: AE36)
                        • 9. Re: Error Handling In 4.2
                          Gus C
                          I will investigate all the options given

                          Thanks for the advice


                          Gus

                          Edited by: Gus C on Mar 27, 2013 11:18 PM