Inside Oracle APEX by Patrick Wolf

No posting for a week, how could that be?

Maybe you have already wondered why I didn't post anything the last week, but I was out of town.

Sphinx IT Consulting, the company I'm working for participated as partner at the Oracle Roadshow "Innovations & Experiences" which toured through some cities (Linz, Graz, Vienna) of Austria. The motto of our company was to show people who want to go the Web 2.0 way, that there also other technologies than Java/.Net to do it.

Especially if you have an Oracle-Forms, PL/SQL and SQL background and your application business logic is stored as PL/SQL packages in the database, you may are looking for other possibilities to leverage your existing code and your skills to get it Web ready.

That's why we demonstrated two tools:
  • WebMagic4DB, a tools which we have build for one of our customers to leverage the existing PL/SQL infrastructure and knowledge of there developers. It consists of a flexible Echo 2 based runtime framework which is driven by a repository and messages from PL/SQL packages. This allows a very flexible and fast development, where you are still able to do all the business logic in PL/SQL and do a smooth transition to Java.
  • Oracle APEX as a good and powerful alternative to JDeveloper/ADF for Web development.
I was "choosen" by our sales department to be responsible for the technical part, so that the people not just hear the marketing "bla bla" ;-)

It was quite interesting and it gave me the possibility to talk with people out there and convince them that there are other ways to web-enable an application than with Java.

Beside of that I also got some infos from customers who are already using APEX. For example the Austrian military is considering APEX to get rid of 22.000 MS Access/Excel applications which are used all over the country. There problem is, that in the past a lot of small applications have been created in the different military stations/deparments/... by recruits during there service time (we have to go to the army) to help them with administrative jobs. But this data is hard to backup, secure, forces duplicate data entry, and so on and that's why they are thinking to centralize that. Sounds interesting.

Labels: ,


« ... Read full posting ... »

Auto Refresh Flash Charts in APEX 3.0

Have you already used the new Flash Charts in Oracle APEX 3.0?

As for SVG charts you can set them to Auto Refresh after x seconds. But it looks like that a small nice feature of the SVG charts is missing for the Flash charts. It doesn't automatically show when the last refresh occurred.

But how can we add that?

At the first look it doesn't seem to be that easy, because no full page refresh occurs, just the Flash chart is updated with an AJAX call.

But at the second look it isn't that complicated if you know the dynamic features of JavaScript. Oracle APEX creates a JavaScript timer which calls the APEX JavaScript library function apex_RefreshChart every x seconds.
<script type="text/javascript" language="javascript">
function chart_r1258481816185669517_InitRefresh(pNow) {
setTimeout("chart_r1258481816185669517_InitRefresh(true)",5000);
if (pNow){apex_RefreshChart (1, '1258481816185669517', 'en-us');}
}

apex_SWFFormFix('c1258481816185669517');
addLoadEvent(chart_r1258481816185669517_InitRefresh(false))
</script>
But how can we intercept the apex_RefreshChart so that we can update a "Last Refresh" timestamp on the page?

It's quite easy if you know how! :-)

In JavaScript a function can be accessed and created like a variable. For example with
var vOldFunction = apex_RefreshChart;
you get a reference to the function apex_RefreshChart which you now can also call with vOldFunction. Nice, isn't it? But what has this to do with the above problem?

It allows us replace the existing apex_RefreshChart with a new version where we do our additional stuff, but which also calls the original function to get the original functionality APEX provides to refresh the chart.
  1. Open the Region Definition of your Flash chart.
  2. Go to Region Source and add the following JavaScript code in front of the existing <object classid=...
    <script type="text/javascript">
    var vOriginal_apex_RefreshChart = apex_RefreshChart;

    apex_RefreshChart = function(page_id,region_id,browser_lang)
    {
    document.getElementById("last_refresh").innerHTML = Date();
    vOriginal_apex_RefreshChart(page_id, region_id, browser_lang);
    };
    </script>
  3. Go to the Region Footer and add the following HTML code which will be a placeholder for "Last Refresh" timestamp.
    <br>
    <center>
    Chart will refresh every 5 sec.<br>
    Last refresh: <span id="last_refresh"></span>
    </center>
What does it do?

It will overwrite the existing APEX library function apex_RefreshChart with a new version which also sets the current timestamp in the span element identified by "last_refresh". BTW, if you don't like the default output of Date(), check out the different JavaScript resources on the Internet to get other formating options.

The above code is also a good example which demonstrates how you can extend/replace the existing JavaScript functions of APEX to add your own behavior.

Want to see an example? Visit my example page.

Labels: , , ,


« ... Read full posting ... »

You haven't been at Collab07 in Las Vegas?

Then you may want to check out Dimitri's, John's and Mark's postings about there impressions of this conference.Thanks guys, was really interesting to read!

Labels: , , ,


« ... Read full posting ... »

ApexLib and HTMLDB 1.6 - does it work?

According to Richard, a Scottish ApexLib user it does!

He has successfully integrated the ApexLib Framework into a HTMLDB 1.6 application. To get it running you have to follow the APEX 2.0 installation steps.

I have no plans to "officially" support HTMLDB 1.6, because I don't have such an environment and 4 different APEX versions are already enough, but it's great to hear that it works with such an old version, too!

Labels: , ,


« ... Read full posting ... »

Installing ApexLib on apex.oracle.com

As you could see with the ApexLib Feature Demonstration application, the framework is also working on apex.oracle.com. But to be honest, it's a lot of work to upload all this single packages and views to apex.oracle.com to be able to install them into your schema.

I got the request to provide a How To document which should describe the necessary steps to install ApexLib on apex.oracle.com.

I thought that's a good time to look at the "Supporting Objects" feature of APEX, which I haven't used yet. With this feature it's possible to install additional database objects, like tables, views, packages or load data when an application is installed. Seems to be the ideal feature to install the views and packages of the ApexLib Framework.

The process of creating the install scripts is pretty straight forward, the only drawback is that if you have a lot of files as I have (29 single files), creating this installation steps is really boring. Note to the APEX team: How about a multi-file upload? :-)

But I finally made it!

I put together a new application which doesn't contain any pages, just the supporting objects. I didn't include it into the Feature Demonstration application, because the regular ApexLib installation should always be done with the provided installation scripts. That's just a goody for apex.oracle.com. Ok it will also work on your APEX installation, in case if you don't have SQL*Plus, but don't tell anybody ;-)

Want to try out the Framework on apex.oracle.com? Download the necessary files from Sourceforge.

BTW, you have to be patient when installing the applications on apex.oracle.com. It takes quite a while...

Labels: , ,


« ... Read full posting ... »

DOAG is hosting a SIG meeting about "APEX for advanced"

The German Oracle Usergroup (DOAG) is hosting a SIG meeting with the topic "APEX for advanced". It will be held on the 31. May in Kassel. See the agenda for more details.

And...
*drum roll*
I will do my first APEX presentation here!
*drum roll*

The title of the presentation will be "The power of the APEX Repository".

There are a lot of other interesting presentations, maybe I see you there!

Some side note to a person I know: Hopefully I don't wait as long as you did to put the presentation together :-)

Labels: , ,


« ... Read full posting ... »

Useful Oracle APEX tools

Did you know that the Oracle APEX distribution contains some nice little tools?

The command line export tool is probably well known, John Scott blogged about it some time ago.

But did you know that there are two additional scripts which can get handy sometimes?
  • apxxepwd.sql in the root directory. This script can be used to set the password for the ADMIN user of APEX. Just in case if you don't remember it anymore. Jornica, thanks for the tip!
  • \utilities\reset_image_prefix.sql to change the image prefix path for an existing APEX installation.

Labels: , , ,


« ... Read full posting ... »

Potential problem with ApexLib 1.6 and Popup Lovs

If you are using ApexLib 1.6 with Internet Explorer you may encounter a problem with Popup Lovs when you select a value. The value is set in the calling page but the Lov Popup isn't closed, instead a JavaScript error is displayed.

Note: This error only occurs if you have included the ApexLib_Lov.js file into your "Popup Lov Template" as described in Chapter 3.12 of the How To Integrate.

Use the following new version of ApexLib_Lov.js to fix that problem.

Labels:


« ... Read full posting ... »

Are you already using the Caching feature of Oracle APEX 3.0?

In case if you don't read the Oracle APEX OTN forum all the time. Recently there was an interesting thread about the new Page/Region Caching feature of Oracle APEX 3.0

The thread contains some insides from the APEX developers how to use this new feature. The provided information will help you to have a smooth start.

Check it out V3 Caching - any more info? for more details.

Labels: , ,


« ... Read full posting ... »

New APEX blog from one of the Oracle developers

Marc Sewtz, one of the developers of Oracle APEX has started his own blog. Check it out at http://marcsewtz.blogspot.com/!

Marc, a warm welcome in the APEX blogging community and I wish you enough time to write some interesting postings!

Labels:


« ... Read full posting ... »

You are at Collab in Las Vegas?

You are at the Collab conference in Las Vegas? Then you should go to the APEX SIG meeting on Tuesday, April 17th.

Get the details in John's posting.

« ... Read full posting ... »

ApexLib release 1.6 available

Maybe you have already seen that I have released version 1.6 of the ApexLib Framework.

My original plan was to make the "Cascading lov" area feature complete in this release, but I was a little bit lazy on the weekend and was looking at some content management systems for the ApexLib Homepage, instead of doing some programming.

But the good news is that this release contains at least some enhancements for the "Cascading lov" area. For example it's now possible to have a popup lov or a multi-select list as master. Checkboxes, Radiogroups, Shuttle, ... will follow in the next release.

Other new features are
  • Tabular Form Validation now supports queries which are returned by a function.
  • The Date Picker check has been enhanced to support the new "use item format mask" feature of APEX 3.0
  • The immediate "Is Required" warning when leaving a field can be disabled.
For a full list of changes see the change log below.

I have also updated the Feature Demonstration site, to demonstrate the new Cascading Lov features.

Get the new release now!

Check the change log file for update instructions.

Change Log:
  • CR# 1683676: Tabular form validations based on dynamic SQL
  • CR# 1685427: Support "multi select list" as master for a cascading lov
  • CR# 1690927: Don't show required warning when leaving empty field
  • CR# 1691701: Popup Lov should also work as master for cascading lov
  • CR# 1692584: Support for APEX 3.0 "Date Picker using item format mask"
  • Bug# 1690057: Don't do any checks if a Tab is clicked
  • Bug# 1684235: addApexValidationErrors doesn't work for Page Level Val.
  • Bug# 1686233: Edit Links not displayed in APEX 3.0


Labels: , , ,


« ... Read full posting ... »

JDeveloper Vs Oracle APEX

In the case if you haven't followed the discussion about "JDeveloper Vs Oracle APEX" on some of the APEX blogs out there.

How did all start?

Chris Muir, did a posting about "A career path for Oracle developers - consider JDeveloper!" some days ago. It contained some statements with high potential for a nice discussion :-) For example that "real" developers who want to make big money and want to learn the "new" concepts "introduced" by Java should look at JDeveloper and not for example at Oracle APEX, because that's not good for your career path.

His statements produced some echo in the APEX blogging scene. First John Scott wrote a reply posting on it, titled "JDeveloper versus APEX?" and a little bit later another follow-up by Dimitri Gielis titled "We shall not use APEX!?". And as you can see from the comments on all three articles and a forum posting in the OTN JDeveloper forum, a discussion has started.

I haven't posted a comment on one of the blogs yet. I first wanted to look how the "fight" about the pro's and con's is going on. Hmm, I still remember the good old time "IBM OS/2 vs MS Windows" - BTW, I was part of TeamOS/2 :-)

Just a quick statement from my side, I will write a real comment on Chris article.

[...] JDeveloper's ADF will provide a higher educational stepping stone away from the old Forms market than Apex will, as it will teach you new languages, expose you to concepts of design patterns and software architecture [...]

I think he is referring to the design patterns of the "Gang of Four" and he also mentions the MVC pattern. To my knowledge they are not specific to Java or .Net, ... Most of them can also be used in other languages like PL/SQL. Or the MVC patter about separation of User interface and Business logic. I can't speak for other Oracle shops, but haven't we always written PL/SQL packages for our business logical and just called them in Oracle-Forms or in a batch job? So what is the new concept here? Sure a lot of developers just put there code into the Oracle-Forms triggers and mix UI with business logic, but so can you also do in a Java environment. Just look at the first JSP/servlet Java projects. Good software architecture has nothing to do with a development language or a platform!

But one thing I want to mention here is that I have sometimes the impression of some "Java guys" out there (not Chris) which misinterpret some of the design/architecture patterns and who create "(database) independent" code/applications just to satisfy the technology, but without any business need.

They start to create several layers of interfaces/code between the Java business logic and the database, just to be able to say "My application is database "independent" and I can replace Oracle with XML files.". (I don't mention here that real database independence is really hard to achieve, just think about read consistency or locking).

I probably would understand that if you are doing product/tool development which you want to sell for different databases, but I suppose most of the Java development is done In-House. How often have you seen that the database is changed during a project??? So why all this interfaces/abstract classes/DAO's, ... (one time I counted 5 different java files/layers/interfaces/abstract classes for an entity object) just to satisfy the design patterns and the "Java" technology?

Why do Java developer tend to re-invent the wheel on the application server and don't use the existing, proven and fast functionality of the database? I know, because then you are not "database independent"! Don't use GROUP BY to sum up your data in the database, it's much more fun pull all the data onto the application server and do it here... ;-)

I really have the impression that a lot of code on the application server is just there to satisfy the technology or the next (Java) "hype". But what is the result? Complex architecture, lot's of code and unmaintainable applications... Could that be one of the reasons why Java projects sometimes tend to take a little bit longer than supposed? :-)

Ok, my comment got a little bit longer and it's just one area which I covered :-)

Now my final question. When we develop an application, do we want to spend our time at satisfying the technology or do we want to solve business problems? I think APEX helps me to concentrate on the business problem. What do you think?



« ... Read full posting ... »

Running the APEX Builder IDE in your native language

Running the Oracle APEX Builder IDE or any other development environment with an other language than English can sometimes be really, let's say "irritating". :-)

For example, if you are used to English database errors and you read the same German errors the first time you sometimes really scratch your head and ask yourself what does this error message mean? Understanding the English translations is sometimes really hard and it doesn't really help that the message is now in your native language which you normally understand... :-)

I always avoid having this hassles, because I read a lot of English tutorials, documentation, postings, ... which makes it sometimes really hard to find the appropriate German translation.

But how can you change the language of the APEX Builder IDE?

It's quite easy. APEX uses the Browsers language setting to determine the Builder IDE language. Just add a "English [en]" before your native language.

Firefox: Tools/Options.../Advanced/Languages
IE: Extras/Internet Options.../Languages


Labels: , ,


« ... Read full posting ... »