3 Replies Latest reply: Apr 30, 2014 7:07 AM by GhanaApexDeveloper RSS

    Delete data in session state

    Gojira

      Hi everybody,

       

      i have a problem with my apex application. When i start the application, it displays the values of items etc., which is stored in the session state. But when i start or end(close the tab) the application, i want to delete this data of the session state. Is that possible?

      I hope you can help me, thanks a lot!

       

      Best regards,

      SSE

        • 1. Re: Delete data in session state
          GhanaApexDeveloper

          Hi,

          Navigate to Applications -> Shared Components -> Application Processes and hit Create in the application builder.

          Create a process which runs “On Submit: After Page Submission – Before Computations and Validations”.

          In Process Source type the following


           IF (:REQUEST = 'T_YOUR_TAB_NAME’) THEN
                APEX_UTIL.CLEAR_PAGE_CACHE(your_page_number);
            END IF;
          
            DECLARE
               l_tab_page NUMBER;
            BEGIN
             SELECT tab_page
             INTO l_tab_page
             FROM apex_application_tabs
             WHERE application_id = :APP_ID
             AND tab_name = :REQUEST;
          
          
             APEX_UTIL.CLEAR_PAGE_CACHE(l_tab_page);
            EXCEPTION WHEN NO_DATA_FOUND THEN
                  NULL;
              END;
          

           

          T_YOUR_TAB_NAME can be identified from the developer mode or using firebug in Firefox on the specific tab your interested in.

           

          Now when a user clicks on a sub-tab the target page's, page cache will be cleared before it loads.

          To clear the cache for another tab, just add a new block to the application process you have created.

          Thanks

          Benjamin

          • 2. Re: Delete data in session state
            Gojira

            Hi Benjamin,

             

            thanks for your reply. I have already added this to delete the session state when changing the tab. But this did not work for my problem, because if i shut the application and open it again, the values are still in the session state. In my former post i meant the browser tab, not the application tab, sorry!

             

            Best regards,

            SSE

            • 3. Re: Delete data in session state
              GhanaApexDeveloper

              Hi SSE,

              if i shut the application and open it again, the values are still in the session state. In my former post i meant the browser tab, not the application tab, sorry!

               

              Best regards,

              SSE

              if this can be achieve i suggest you clear the cache of the whole application

              Look up : Managing Page and Region Caching

              Thanks

              Benjamin