Thursday, April 16, 2009

APEX Star Rating - Amazon style

Recently there were two threads on the APEX OTN Forum regarding the implementation of an Amazon-style star rating mechanism (this thread and this thread).
Using this jQuery plug-in that implementation is not so difficult. The first step (of course you've installed jQuery) is to install the JavaScript and CSS of the plug-in. To create a demo I added two columns to the DEMO_PRODUCT_INFO table : RATING and VOTES.
The second step is to create a PL/SQL function and use that in your select statement to show the current rating:

create or replace function GET_STARS
( pID in NUMBER
, pRating in NUMBER
) return VARCHAR2
is
l_retval varchar2(2000) :='';
BEGIN
FOR i in 1..5 LOOP
IF i = pRating
THEN l_retval := l_retval ||'<input class="star" id="'||pID||'" name="star'||pID||'" value="'||i||'" checked="checked" type="radio">';
ELSE l_retval := l_retval ||'<input class="star" id="'||pID||'" name="star'||pID||'" value="'||i||'" type="radio">';
END IF;
END LOOP;
RETURN l_retval;
END;
Then add a click event to the elements with a 'star' class
$(function(){
$('.star').click(function() {
saveRating( $(this).attr("id"), $(this).children().attr("title") );
votes = Number($(this).parent().parent().next().html()) + 1;
$(this).parent().parent().next().html( votes );
});
});
where saveRating is just a 'regular' AJAX OnDemand process that calls a PL/SQL Procedure that does the actual update.
The result is quite good: You can hover over the stars and a click saves the rating (of course you would need another data model to save and calculate all ratings and prevent users from rating more than once, but that's for later).
You can see it live on apex.oracle.com.

Tuesday, April 07, 2009

Discussion about Forms to APEX Conversion

On his blog, Grant started a discussion about the reasons - and especially managing the expectations - of converting Forms to APEX. The interesting thing is that also Joel Kallman (from the APEX Development team) joined the conversation, therefore making it a sort of Oracle internal discussion platform...
That you can use both technologies together proves this picture (the region on the upper left is an Oracle Form). I will present at ODTUG on the "how-to's".... (another shameless plug).

Wednesday, April 01, 2009

OBUG 2009

Yesterday (March 31), the Oracle Benelux User Group held its (almost) annual conference in Antwerp. Apart from the three central keynotes, the around 600 attendees (my guess) could pick one of the 10 concurrent sessions - in three timeslots. The conference was mainly 'Apps' driven: most sessions where from an Apps-perspective - so there were only a few interesting sessions from a database / development point of view.
José Lazares (Vice President Applications Development and Applications Integration Architecture) did the first keynote. The message I got from it was: more BI dashboards presenting data from different sources (a lot of screen shots with nice graphs). I skipped the first concurrent session, because I had to be on our stand. The second sort of keynote was by Tom Sligting, a Dutch stand-up comedian. He had some very funny jokes, but had a hard time with the sometimes barely-responsive audience.
Lonneke & Lucas did a duo presentation on SOA Suite 11g (in fact it was a trio presentation, because Ronald ran a demo from the projector room - 50 meters from the stage). Seems like 11g is aiming at building more integrated solutions, because you now can use the different tools in a single project.
The last session was 'Forms 2.0' by Wilfred van der Deijl, who presented his view on migrating from an Oracle Forms to an ADF world. I was already familiar with his work, especially the OraFormsFaces stuff, because I use his technique for a part of the Oracle Forms/APEX integration (which I will present during ODTUG Kaleidoscope, - shameless plug - ).
All in all a good, well organised day, with - and I have to admit - really good food...

OOW2009 CFP

The above mysterious acronym stands for: Oracle Open World 2009 - Call for Papers. You can be part of the 'greatest show on earth: Submit your papers here.
With the risk of reducing my own chances of getting a paper accepted...