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.
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.
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.
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!