1 2 Previous Next 18 Replies Latest reply: Sep 8, 2010 11:36 AM by 756714 RSS

    Clear cache for all items after going to another page

    jfosteroracle
      Greetings,

      I have an application where I have a radio group with Submit. When I am on that page, after the submit and it comes back to the page, I don't want the cache cleared for items on that page. But once I go to any other page in the application, I would like the cache cleared for the items on that page. In other words, i'd like the values in my items to stay until I leave the page. Then once I come back to the page, I don't want to see the choices I made when I was on the page the last time. How would I go about doing that?

      Thanks in advance,
      John
        • 1. Re: Clear cache for all items after going to another page
          510477
          There is a very simple way to do this. Create a page process that fires BEFORE HEADER of type Session State: Clear Cache for all Items on Pages (PageID,PageID,PageID).

          For the condition, you can do it one of two ways:
          1. In the Condition, use Request = e1 and set the request to NEW. When you link to the page, set the request value to NEW. Anyone coming in using a link will trigger the page refresh.
          2. The opposite. Use Request = e1 and set the request to FRESH. Then set your branch for the existing report on the page with the SUBMIT value of FRESH. Only when the button on the page is used (which is set to correspond to your FRESH branch condition) will the page get reset.
          • 2. Re: Clear cache for all items after going to another page
            jfosteroracle
            So what is the simple way? :) - Just kidding - (sort of...)

            I followed you up to the point of "When you link to the page, set the request value to NEW. Anyone coming in using a link will trigger the page refresh." I don't know what you mean by that part.

            - I have a type of 'Clear Cache for all items on pages'.
            - I have the process point as "On Load - Before Header"
            - I have the source as my page number i was cleared.
            - I have my Conditional processing as "Request - Expression 1", with Expression 1 as 'NEW'.

            What am I missing?

            Thanks,
            John
            • 3. Re: Clear cache for all items after going to another page
              510477
              So in HTML, whenever you use a "form" (which is basically ANY page in APEX), you are requesting a new page from APEX. In HTML terms, you are supplying a GET action to the page, and you can attach a request value to that, such as NEW.

              In a link from another page to this page, that link will have an attribute called REQUEST that you can set. This is where you can specify a REQUEST value such as NEW, which will get passed to the page when the user clicks on the link. Sometimes, you can set this REQUEST value in the Page Branch.
              • 4. Re: Clear cache for all items after going to another page
                jfosteroracle
                Sounds good. Where do I set the REQUEST you mention? I have the condition processing for that process set to:

                Condition Type - 'Request = Expression 1'

                Expression 1 - 'NEW'

                What else do I need to do? I don't have to set that request on every page that I go from to this page, right? I have 95 pages in my appication.

                Edited by: jfosteroracle on Jun 23, 2010 4:24 PM
                • 5. Re: Clear cache for all items after going to another page
                  Linnemeyer
                  Unless you are doing something unusual to get to your page this should be very simple.

                  On all OTHER pages that branch to your page in question, in the Action section of the branch definition put your page number in the Clear Cache field,or if instead of a branch you are using a button with a redirect on the OTHER pages put your page number in the Clear Cache field of the Optional URL Redirect section of the button definition.
                  • 6. Re: Clear cache for all items after going to another page
                    jfosteroracle
                    I have 95 pages in my application. So I would need to put that page number in the CLEAR CACHE section of all 95 pages? Isn't there a better way to do it where I don't have to add that to 95 pages?

                    John
                    • 7. Re: Clear cache for all items after going to another page
                      510477
                      So let's take this from the top again. You've got your page process created and a condition set. Great. Now step two is to set up the item that triggers the refresh. You can either set this to be an item on your page such as a button, or it can be a link on another page. If you are using common lists for navigation, you can set the REQUEST value in your link item once and every page that list is on will get the updated list.

                      The other method is to take an inverted approach and set a REQUEST value on all your page items you DON'T want to trigger the refresh, then set the condition on the procedure to fire when REQUEST != e1.

                      Did that make sense?
                      • 8. Re: Clear cache for all items after going to another page
                        jfosteroracle
                        Sorry, guys, I'm getting lost in the replies. Let me state my situation again, from the top. I have a page with a 'radio group with Submit'. So I make a selection with the radio group, the page submits, and it comes back to the same page, and that radio group selection is still as I chose it (items were not refreshed). So far, so good.

                        Now, when I go to any other page in my application (1 of 94 other pages), when I come back to this page I want the cache for that page cleared so that my radio group goes back to its default selection.

                        Make sense? So what I am wanting to do is clear the cache on a specific page when I come back to that page. If I could clear the cache based on the standard tab i push, that would work great, but I can only do that from a parent tab.

                        Does that help explain my situation?

                        Thanks for all your help in advance!!

                        John
                        • 9. Re: Clear cache for all items after going to another page
                          510477
                          John,

                          No problem, just take it slow. In APEX, you have lots of links between pages. Each of those links can have attributes and actions assigned to them. Edit the link and take a look. One of the things you can do as an action from a link is to called Clear Cache. You put in the page number of the page you want cleared here. You have to do this for every link that points to that page. That is option #1.

                          The other option is to handle it entirely from the page itself. If you want me to go back over that part, let me know.
                          • 10. Re: Clear cache for all items after going to another page
                            jfosteroracle
                            Yes, thanks. I understand the CLEAR CACHE part. I have 95 pages, so I would like to avoid having to clear the cache of 'page 302' from every page branch. I would like to be able to handle it entirely from page 302. And I don't want the items refreshed when I am on that page and come right back to the page with a SUBMIT (when I click on my radio group with submit). Hope that makes sense.

                            John
                            • 11. Re: Clear cache for all items after going to another page
                              510477
                              Great. Okay, if you want to handle everything from that page, here is one method. What we want to do is acknowledge two different states: one where we want to keep the session state and one where we don't. So we need to differentiate those two. An easy way to do this is to assign a SUBMIT value to the page items/buttons you don't want to clear the cache, and then create a CLEAR CACHE procedure set only to fire when the SUBMIT value != those local page items/buttons.

                              Example: In your case, you have a page item: Radio Button with Submit. Along with that item you also have a Page Branch that directs back to the existing page. In that page branch, set the value of SUBMIT to NO.

                              Now create a Session State: Clear Cache procedure and set the condition to Request != Expression 1. Under Expression 1 put NO.

                              What this will create is a process that will fire every time the page loads except when triggered by your page items/buttons. If you have more than one page Branch back to the same page, make sure the SUBMIT value is set on all of them.
                              • 12. Re: Clear cache for all items after going to another page
                                jfosteroracle
                                Thanks for your patience! So when you say, in the page branch, "set the value of SUBMIT to NO", what do you mean? I am looking in my Edit Branch page, and i don't see any field called 'SUBMIT'. I see 'request', 'Set these items', 'With these values', etc.

                                I'm probably looking right at it and don't see it. Sheesh....

                                John
                                • 14. Re: Clear cache for all items after going to another page
                                  Linnemeyer
                                  Here is the easiest way to handle this. Easiest but NOT a best practice as it will fire on every page, but since it is not a real big process the impact should be minimal.

                                  In shared components go to Application processes.

                                  Create a new process, with an On Load Before Header Execution Point

                                  enter the following for the source

                                  apex_util.clear_page_cache(302);

                                  Make the condition type: Current Page not in Expression 1 and enter 302 in expression 1

                                  This will take care of the issue.

                                  Are you branching to this page from all 95 of your other pages??
                                  1 2 Previous Next