Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Best way to display current date time on each page

scotApr 20 2007 — edited May 3 2013
Hi. I've tried searching the forum for this, but these are very common search terms, and while I've learned a bit from the threads I've found, I haven't found my specific answer. I'm happy to read a thread if pointed in the right direction. I'm using APEX 3, and as will become evident shortly, I'm quite new at it.

My Question: I'm looking for the best/preferred way to display the current date and time on each page in an application. Or at least, each page in an application that uses one specific page template. I'm using theme 16, Dark Blue, and the page template of interest is One Level Tabs with Sidebar.

An added complication is that I'm not wanting to display it in one of the standard region position numeric place holders that the template defines. Instead, there is a little blue box in a cell towards the top left of the page that would be to the left of the breadcrumb, and above the sidebar region. There is actually a label in the td code for this cell; class="t16SideBarTitle"

I put some static text there in that cell as a test and it shows up perfectly where I want it. Now, this date time would need to be refreshed with each page. The question is how best to accomplish it.

My current attempt is to create a hidden Item on Page 0, called P0_DATE, and to put the text "&P0_DATE." right there in the cell I want. The item itself is defined to have a "source value or expression" of:
to_char(sysdate,'Dy, Mon DD HH:MI:SS PM')
The "Source Used" is "Always, replacing any value in session state"
The "Source Type" is PLSQL Expression or function"

Now, this method comes close. It displays the date and time right where I want it, in the format I want it. And when I click on different tabs in the app, it refreshes the date and time as I'd like. But it doesn't refresh when I refresh the page, or when I click on the breadcrumb entry to the page, or when I click on the navigation list to different pages that I have placed in the sidebar region.

When searching this forum, I found another possible approach, a reference to Application Items. So another option might be to create an appication item to hold the datetime. My hesitation in doing so is that when you click on application items from the shared components page, the first line of the help text is: "Use Application Items to maintain session state". I don't want to maintain session state. I want this value to be reset each time a page is clicked on, or each time the current page is refreshed.

But, if I did create an application item, it looks like I could create a corresponding application process to load the value in an anonymous plsql block on load before header. With something like select sysdate from dual, although I'm not sure yet how to get it into my application item.

Or, it looks like I could create an application computation. It looks like I could use the same idea as the hidden page 0 item above, with the same plsql expression. I would then set the computation point to before header. But if I did, should the computation item be an application item, or the hidden page 0 item from before?

So to recap, and thanks for having the patience to make it this far, should I:

a) use a hidden page 0 item and alter how I'm doing it to make it work
b) use an application item with an appication process
c) use an appication computation with an application item
d) use an appication computation with a hideen page 0 item
e) use some prebuilt way of doing this that I don't know
f) use some other custom alternative

And with all of the approaches, is using the substitution of "&ITEM." directly in the page template the preferred way to go, since I don't want to use an existing region position or page body substition point? Should I instead create a new substituion point assuming that it is possible to do so?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 31 2013
Added on Apr 20 2007
6 comments
2,906 views