Tuesday, December 23, 2008

My UKOUG ratings

As a final message from the UKOUG I got the ratings for my session. And they are absolutely amazing (4 = Good; 5 = Very Good; 6 = Excellent):

OverallMy Session
Presentation Skills4.405.37
Quality of Slides4.205.43

Some additional remarks: I wish my line manager (who has a Java background) had seen this presentation as he thinks Apex is too lightweight! Excellent!; Great; Fantastic session; Great!; Would like more. Just what I needed to know to solve some issues, but I've got no tech ability yet - off to read :-); Excellent demo - very interesting. Has shown the possibilities open to us!; lots of javascript is hard to follow.

So I am glad I was in this session ;-).
Thanks everybody who rated me for these great results. I hope I can keep up this level for the next events (O>Zone, ODTUG).

Thursday, December 18, 2008

Abstract ODTUG accepted!

Yesterday evening I received an e-mail from the Speaker Coordinator of ODTUG's Kaleidoscope 2009 that my abstract on How to integrate APEX and Oracle Forms? has been accepted for presentation!
I'm looking forward to present and to meet again all the great people I met at the previous event in New Orleans. I have 'some' time to create the actual presentation - with some nice demo's of course - because the event is starting about half a year from now.
If you have any specific subject on this matter you would like to see during my presentation, please drop a comment!

Wednesday, December 17, 2008

Moving through tabular forms using the Up/Down arrow keys

Today there was a question on the Oracle APEX forum about How to Navigate through the rows of Report using up or down key. This question pop ups now and then and I decided to figure out how to do this. The solution is quite straight forward:

Set the Element Attributes of the columns of the tabular form to :
onkeyup="moveUpDown(this, event)"
and create a that function in the HTML Header:

function moveUpDown(pThis, pEvent){
var keynum;
var current = document.getElementsByName( pThis.name );
if(window.event) // IE
{ keynum = pEvent.keyCode; }
else if(pEvent.which) // Netscape/Firefox/Opera
{ keynum = pEvent.which; }
if (keynum == 40 || keynum == 38) // Key-Up or Key-Down
{ for (i=0;i < current.length;i++)
{ if ( current[i].id == pThis.id ) // This is current row
{ if (keynum == 40) // Move down
{ current[Math.min(current.length - 1,i+1)].focus(); }
else // Move up
{ current[Math.max(0,i-1)].focus(); }
Check out the live example.
PS: Changed the code a little on Dec 18 to prevent javascript errors when pressing Up on the first row and pressing Down on the last row.

Tuesday, December 16, 2008

LOUD 2008

Yesterday evening Logica held the annual LOUD (Logica's Oracle Update Day) event. A tradition is that there is an award for 'Best Acting Consultant' (nothing to do with role playing ;-) ). And this year the winner is....(or are): Rutger and myself! We got the award for our continuous effor to spread the APEX gospel within - and outside - Logica. And of course a bottle of champagne came along...
Apart from that there was a keynote and 12 presentations in four tracks - Fusion, Development, Apps and DBA. Rutger and I also did a Live-Web-Application-Development-with-APEX session (for which we received an addtional bottle of wine....).
All in all a great evening, and it is always good to see so many colleagues (about 160) 1interested in the Oracle toolstack.

Monday, December 15, 2008

It is even more easy to replace the APEX with the jQuery calendar...

In a previous post I described how to replace the default APEX calendar with a better looking jQuery calendar. But one of the steps is that the "Display as" and "HTML Form Element Attributes" needed to be changed. But using jQuery more extensively that isn't even necessary. When you put the following code in an HTML Region on Page 0 (assuming you already included the jQuery stuff), all existing APEX calendar items are automagically 'converted' to jQuery calendar items. (No guarantee though: I didn't test it on all sorts of pages, may be dependent on your template). Look here for a live demo...

// Remove original Datepicker
$("td.datepicker + td" ).remove();
// Add jQuery Datepicker to all Datepicker input fields that are not hidden
$("td.datepicker > input[type!=hidden]" ).datepicker(
{ dateFormat : 'dd/mm/yy'
, closeText : 'X'
, clearText : ''
, showOn : 'button'
, buttonImage : '#WORKSPACE_IMAGES#calendar.gif'
, buttonImageOnly : true

Friday, December 12, 2008

APEX : How to emphasis Required Fields...

In APEX there is no property to mark a field as a required field (at this moment, could be an enhancement request!). However you can mark the prompt of a field by using the 'Required' template - with or without help. So why not use the APEX Repository to enhance the look-and-feel of your application and show the user which fields are required? And of course we use jQuery to accomplish this.

This is how you do it:
Create an On Demand Application Process (lets call it getRequiredItems) and fire it onLoad - After Header:

CURSOR c_items IS
SELECT item_name
FROM apex_application_page_items
WHERE item_label_template LIKE 'Required%'
AND page_id = :APP_PAGE_ID;

item_list varchar2(32000) := '';
item_sep varchar2(1) := '~';

FOR r_item IN c_items LOOP
item_list := item_list||r_item.item_name||item_sep;
-- P0_REQUIRED_ITEMS is an hidden item on Page 0
:P0_REQUIRED_ITEMS := substr( item_list, 1, length( item_list ) -1);
This process returns the items with a 'Required'-prompt for the current page in one long string, separated with a ~.

In Page 0, create a Javascript function that adds a class ('RequiredField') to the fields in the P0_REQUIRED_ITEMS string filled by the Application Process and (optional) adds an onblur event that calls a function (checkRequiredField) using

function setRequiredItems(){
var colArray = $v("P0_REQUIRED_ITEMS").split("~");
for(i = 0; i < colArray.length; i++){
Now you can create an entry in your CSS file to give the required field a nice color (or whatever else you want).
Next create the Javascript function to check if a required field is empty or not. If the field is empty, the user cannot navigate out of the field, unless he puts in a value.

function checkRequiredField(pThis){
if (!(pThis.value)){
alert('Field must be entered');
setTimeout(function(){pThis.focus();}, 5);

Now add this Javascript function to the jQuery document.ready function:


And the result is something like the picture on the top of this post. A live example is available on apex.oracle.com.

Thursday, December 11, 2008

How to replace the default APEX calendar with jQuery calendar...

One of the things I talked about during my presentations at OOW and UKOUG is how to replace the (not so good looking) default APEX calendar with a (much nicer) jQuery version. So here are the steps:
1. Download jQuery and jQuery UI from the jQuery website. Upload the jQuery javascript files to your webserver (or into your database if you are using the EPG). Or use GoogleCode...
2. Create a HTML Region on Page 0, containing the references to the uploaded stylesheets and javascript files. Something like this:

3. Set the "Display as" property of the date fields to 'Text Field" and set the "HTML Form Element Attributes" to : class="datefield".
4. Back in Page 0, add a function to the jQuery 'document ready' function to add the jQuery datepicker to all fields with that class:
5. Run your page and see the results. It should something like the picture on top. I created - a very small - 'running' demo on apex.oracle.com.

Update: In FF all works great, but in IE6 and IE7 the vertical position of the calendar DIV seems to be calculated wrong (using jQuery 1.2.6). Probably a bug in the jQuery lib...

Tuesday, December 09, 2008

Oracle Designer Extension for SQL Developer

In SQL Developer there is an Application Express node. That is a great way to browse through the APEX Repository. And wouldn't it be great if you can use the same technique to browse your Designer repository?
Can we build it...yes we can...
Using User Defined Extensions you can create something like this:'Just' create an XML file to query the Repository and add it as an extension of the Navigator type. This XML file does what is shown in the pic above (it is not finished yet, and anyone who wants to contribute...feel free to add more subnodes/details!). Just click on 'expand source' to see the code.

SELECT 'Entities' name from dual
SELECT 'Functions' from dual

SELECT b.id, b.name
from ci_app_sys_entities a
, ci_entities b
where a.application_system_reference = :APP_ID
and b.id = a.entity_reference
and 'Entities' = :SEL_NAME

SELECT a.id, a.name
from ci_attributes a
where a.entity_reference = :ENT_ID

SELECT b.id, b.short_definition
from ci_app_sys_functions a
, ci_functions b
where a.application_system_reference = :APP_ID
and b.id = a.function_reference
and 'Functions' = :SEL_NAME

Thursday, December 04, 2008

UKOUG 2008 Report Back

This year I decided to do just one post about the UKOUG and not - as previous year - (try to) get out a post every day. Takes the pressure of me...
The first impression is that Birmingham was quite cold this time of year, the second is that the UKOUG seems less crowded this year. The first observation is quite right, the second one is wrong. Due to the shifted schedule of the session, they not all start and end at the same time, so the crowd is more scattered over the day. So no long lines for the food or traffic jams in the Exhibition Hall (the fact was that there where about 2,250 attendees, 'just' 5% less than next year - probably to do with the financial situation out there).
I won't list all the sessions I went to: See the previous post about my intentions - I didn't made all of them...

My personal top 3 this year (in order of appearance):

Beginners' Guide To Trouble-shooting
by Jonathan Lewis
I had never seen Jonathan presenting before but it is good to get an introduction into this subject by the master himself. He split up the performance in a quadrant with 'Wait Time' and 'Service' on one side and 'Using' and 'Competing' on the other side. That gives an insight where to look for one of the three classifications of problems : 'My task is slow', 'The batch took too long', 'The system is slow'.

Oracle SQL Developer: Focusing on a Few Advanced Features by Sue Harper
Sue showed how to create and use XML extensions, remote debugging APEX applications and how to Refactor anonymous PL/SQL blocks in APEX into database procedures. If she had the time she could have shown a lot more than she did, but (just like in a lot of other sessions) 45 minutes is very very short....

Performance Tuning Basics by Doug Burns
Doug did a great job in big Hall 1. His presentation ran very smoothly as well as in presentation style, in the sheets (just a few words or a picture on every sheet) as in content. He explained about ASH, AWR and ADDM - acronyms I had heard about but didn't quite understand the details (as I am not a DBA - apparently). The main message was: The only thing that really matters in the end is: DB Time, not latches, buffer gets, reads etc - only the time that passes between a user action and a system response defines the performance (but of course all the reads and latches and stuff lead to a certain DB Time...).

My own session:
On the last full day of the conference around 03:00 PM I had my session. It was a rather small room, with around 100 seats but pretty well attended with an audience of around 80 people. IMHO all went very good, ended right on time and could even answer some questions. My goal was to show that you can do a lot more with APEX than what is widely known and I think I got that message across. I did a sneak peek at the evaluation forms and saw a lot of 'Excellents' and 'Very goods' and some very positive comments. So I was (and still am) quite happy about that! BTW I already uploaded the application to apex.oracle.com, but I still have to seed it with some data. If that is finished I'll post the link on this blog.
Because there wasn't that much APEX going on, I 'had' to visit sessions with other interests, like performance tuning and JDev. I don't know yet if that's a good or a bad thing. But I will sure to try to get in (again as a presenter) next year! BTW next year the UKOUG will split the different streams into different shorter events. The (to me) most interesting event will still be at the end of November, but then only for three days.