Well I was at Web2.0 Expo last week and saw many recurring themes with building and deploying applications. Most of which , being biased as I am , I think Application Express is well suited for.

Two of the most often heard were SaaS and Cloud Computing (the cloud!!!) and was wondering if there was any interest of an APEX offering in those contexts.

So being the type of person I am ,I want to hear straight from the people and put this post here on the OTN forums.


and this posting on mix.oracle.com


So have at it all comments / opinions welcome

Begin PSA.

This is a quick heads up , if you haven't checked the blogs you link to lately and you link to anything on orablogs.com you might want to remove or change that link.

orablogs.com isn't what you think it is anymore ;)

While the first click through is "probably" SFW any link or popup after that is probably NSWF.

Stupid link farms.

End PSA.

One problem with APEX is it has issues with dealing with text values of greater than 32k, while there is a fairly simple workaround it does have quite a few pieces and there has to be an easier way to do it.

Well in APEX 3.1 there is now an integrated javascript call to take care of this. This example also shows some of our new namespaced javascript objects and functions.

I've created a working example here.

Setting the CLOB

What's happening in the previous piece of javascript is I'm creating a apex.ajax.clob object. This object only takes one parameter when being initialized which is a function , or pointer to a function, to call when the XMLHTTP object's readyState changes. In that return function ,and for all built in APEX asynchronous AJAX calls, p is the XMLHTTP object.

Once the apex.ajax.clob object is created you just call set method giving it a string ._set(String Value);

It will automatically create a collection in your session CLOB_CONTENT and populate the CLOB001 column.

You can then use that in a page or application level process , usually by calling a doSubmit() and submitting the page.

The p.responseText on successful population of the CLOB will be SUCCESS.

Getting the CLOB

Getting a CLOB is much the same as setting one. Create the apex.ajax.clob object setting the function to call when p.readyState and then call the ._get() method which doesn't take any parameters.

This solution only deals with one clob at a time and the clob is alway put into the CLOB_CONTENT collection, though dealing with multiple clobs is also much easier, more on that later ;). But it is much easier to work with than the old workaround.

I just watched 2001: A Space Odyssey in the last week in HD. If you've never seen or it's been awhile or never seen it in HD do yourself a favor and check it out it's an amazing movie, though it looks like they were a little off on the dates.

Sometimes you only want a region / item /tab /list etc to show up if your in development mode.

Sure you can add a authentication and authorization setup and take care of this but a quick and dirty way is set the condition to PL/SQL Function Body Returning a Boolean and use this code.

For a production application please take the time to set up a proper authorization rule, but for development this is simple and works.

Considering this is a quick and dirty fix/tip I guess it's the unwashed one :)

New Stuff (Q & A)

Most of my last couple posts have focused on new APEX 3.1 features. And there have been some good questions in the comments. So I figured I'd go through some of them in a post to make the answers a little easier to find.

Question 1

What is the difference between add() and addParam()

They are used for passing values in slightly different ways and with different results.

.add() should only be used when dealing with a page or application items, anything else will cause an error, things you set with .add() will also automatically be set in the session state.

.addParam() should be used with what we term as parameters, the main difference being is they are not set in session and are only available for that particular request.

Can I set those global variable's values like common items in PL/SQL:
... or is there any more concise way to do it ?

No you can't set these into the session in PL/SQL. Remember those values are temporary and will not be saved past each specific request. If you need to save values from one of these that's the perfect reason to use a application level item, or collection.

Question 2

There's something I don't get.
Why do you need a temp item at all?

Mainly because it's much easier to build reusable/generic AJAX components that can be used in multiple applications. It's also going to be a big part of how the AJAX component for custom item and regions types will be implemented, more on that later. Don't get me wrong there are very good reasons sometimes to use an application or page item but many times it's not.

A quick rule of thumb is if you want to save a value into session use the application or page items, if you just passing values, use the generic ones.

Question 3
There is also g_widget_name, g_widget_num_return and g_clob_01. Could you explain them also?

g_widget_num_return I just plain missed this, my bad. Many times when I was building something using these new handy parameters it just seemed like I was also adding a number to set the number of return values, instead of wasting one of my x01-x10 we added another one. I've update my code example and the blog posting to show this.

I skipped g_widget_name on purpose as it will be used in a slightly different way in the future. You can absolutly use it now to pass values and it it won't break anything, in fact I'm working on an example that does just that.

g_clob_01 That one at the moment is unused, and might be removed, so I'd stay away from it. If you need to hold on to a specific CLOB the best way is to create a collection and use the clob column in that.

Thanks, for the questions, Matjaz , Anonymous and Mark

Also Doug Gault yet again is the first to to figure out one of my slightly obscure cultural references , good job Doug!

Face front, true believer!

Well this is interesting Marvel and Oracle.

Gotta love the link direct link to APEX.
Makes the job kinda surreal.

extra points if you know the quote!

Themes and Theme Testing

I've created an application here that lists out all the themes contained in APEX along with a thumbnail. Each image links to a copy of our theme testing application running that particular theme, the theme testing application is just the regular sample application with extra pages to cover different template and item types.

When we build out themes for APEX we build very generically and the theme testing application is what we use to test against. Feel free to download the theme testing application and use to test your own themes or theme variations against.

Vikas used to host applications showcasing the themes but I figured we (APEX team) should take the time update them with every version change and Theme Testing Application change. Like I've stated before I have almost no moral issues with 'borrowing' a good idea , but I did contact Vikas and ask first ;).

If you think we are missing a use case in that application please drop a line in the comments, or better yet comp one out on apex.oracle.com and put a link in the comments. Remember we build very generically so the themes can handle as many data and usage variations as possible.