Disclaimer

The views and opinions expressed in this blog are my own and do not necessarily reflect those of my employer. The views and opinions expressed by visitors to this blog are theirs and do not necessarily reflect my own

Wednesday, November 14, 2007

Apex Gotchas

While Apex is an intuitive easy to use development environment it can cause some frustrations and has a number of gotchas that are worth been aware of. The following are a few I've discovered over the last couple of months.

Validations of type PL/SQL Expression without conditions

This little beauty caused me an hour and half worth of grief.

Set up a pl/sql validation of type pl/sql expression, give it a name but leave the condition entry blank.

When you run the page you will see “Invalid PL/SQL Expression” at the top of page before the header and rest of your page.

POP LOV, display description return value returns “undefined”

If you have a page item (Select List), which uses an LOV query, and have enabled null columns (but not specified a null value) you can typically expect the value in the session state to be “%null%” after the page has been submitted.

However it appears that if you have a “Popup LOV, display description, return value” item then the null value actually gets submitted to the session state as “undefined” and not “%null%”. Although this one is easier to spot it more of an annoyance and just appears odd as it actually returns “undefined” to the display area too.

Setting Page Items in Validations, Report Regions and PL/SQL Function Body Conditions

Have you ever worked on a bit of functionality where you're effectively hacking it to get it to work with the good intention of re-factoring it later and make it look pretty?Well on one occasion where I had forgot to go back and re-factor a particular page I had worked on I discovered that I had set a page item within a validation.

Logically thinking, I personally would not expect to see a page item set in a validation (your circumstances may be different). Apex allows you to make an assignment to a page item anywhere you can place PL/SQL blocks (E.g. report regions returning SQL Queries, item/region conditions (I.E. function body returning boolean), LOV Queries. Generally speaking I'd expect such a function to be carried out in process. The old saying , “just because you can doesn't mean you should” comes to mind.

I feel this is a good example demonstrates the need for standards and consistency when developing Apex Applications if not for your own sake then for the poor person who is going to support your application once your gone. More about good practice in a later post.

I did have one more gotcha, concerning dates but can't remember the specifics, if I do I'll add it to the list, likewise if anyone has any more please feel free to add them to the comments section and I'll update the post.

(The gotchas may not apply to versions of Apex greater than 2.2.1 unfortunately the project I was working on was at that particular version)

0 comments: