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:
APEX_UTIL.SET_SESSION_STATE(wwv_flow.g_x01,null);
... 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!
The Application Express instance on apex.oracle.com has upgraded to 3.1
I am currently working on HOWTO's for working with some of the new features in 3.1 , the first one goes over development for Mobile's.
I am also working on my sample application and updating it to take advantage of some of 3.1 features, there have been quite a bit of changes that make those examples much easier to implement.
On a personal note I greatly enjoyed my 2 hours of downtime after code freeze before we started talking about the next set of things we want to get done ;)
This is one big long rant and bounces around a bit but stay with me :)
I'll admit it I'm a hypocrite when it comes to web development. I'll rant and rave about about standards compliance and the right way to do things.
http://carlback.blogspot.com/search/label/standards
http://carlback.blogspot.com/2006/11/javascript-pet-peeves-for-some-reason.html
Then I'll turn right around and use tables for layout, and add my own namespaced attributes to HTML elements and then tell people not to worry about standards mode and XHTML validation.
http://forums.oracle.com/forums/thread.jspa?messageID=1138556#1138556
http://forums.oracle.com/forums/thread.jspa?messageID=2051001#2051001
http://forums.oracle.com/forums/thread.jspa?messageID=1025081#1025081
http://forums.oracle.com/forums/message.jspa?messageID=2271436#2271436
http://carlback.blogspot.com/2006_09_01_archive.html
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:561667500346126206#611615600346656142
You might ask how I can do this and look myself in the mirror, especially some of you that have been on the the receiving end of the ranting, well let me tell you there are three very important reasons.
TIME , MONEY , REALITY
TIME and MONEY you never have enough, neither does your boss/company/client/etc. And you need to finish the current project you are on yesterday and get started on the next project the day before that , sound familiar ;)
Getting to 95% standards compliance is easy, that last 5% is what is the killer, and nobody even cares except some buggy W3C validator.
http://blog.360.yahoo.com/blog-TBPekxc1dLNy5DOloPfzVvFIVOWMB0li?p=736
XHTML is not the solution to a problem that concerns anybody except the guys who have to write
parsers that convert markup into DOM trees.
Building a tableless layout is all great and good. Except then you have to spend extra time and effort QA'ing because the different browsers render CSS different, or not at all (more on that later).
Even if the newest browser version renders things better if you are like most people and want to reach the biggest audience then you need to support older browsers for a long time (IE 6 is not going away anytime soon).
REALITY is the 800 pound gorilla and that gorilla's main branch to beat you over the head with is my favorite, the most useful and most ubiquitous piece of software in the world, the web browser.
It's not my fault I didn't do it.
MS did it with IE.
Netscape did it with Netscape. (RIP)
Mozila Group did it with Firefox.
Apple did with Safari.
Opera did with Opera.
And what did they do?
They are the ones that don't render things correctly and even more importantly they don't render consistently , and let me tell you the big secret, they probably never will unless they all decide to start using the same rendering engine, which isn't going to happen, and truthfully shouldn't, competition is good and will result in better browsers. Look how much better IE7 is compared to IE6 and IE 8 just passed the ACID 2 test which is huge, and the reason for these improvements because Firefox is so much better than IE, at least for now.
Don't get my wrong standards compliance is a worthy goal, but like most things in this world it's the journey not the destination that is the worthier part.
As you strive to get to 100% standards compliance your page weight goes down, your CSS gets separated out of the HTML to where it belongs. And the closer you get the easier it is but it's a never ending process, HTML 5 will be here sooner than you know it, and this will start over again.
On APEX's end we will continue to make sure the HTML we generate is as close as we can make it to XHTML compliant as we can while still supporting the widest range of browsers in the easiest way.
PS. NO!!!! YOU STILL CAN'T USE FONT TAGS ANYMORE, THAT IS TOO HYPOCRITICAL EVEN FOR ME!!!!!!!!!!!!!!!!
Wow a real APEX posting can you believe it?
So I got an email from Alistair Laing asking about a certain example of mine , (AJAX) Report Pull.
He rightfully pointed out that if you used one the AJAX enabled report templates the AJAX pagination worked but the sorting wouldn't work, sometimes.
The reason for this is that the AJAX templates are a HACK! That's right I said it ,I can because I built them, sure they are a successful , well used, robust HACK but a HACK none the less.
The issue with the sorting not working is because the header links are rewritten when the page loads so that the headers no longer have normal links but have AJAX enabled links. The pagination doesn't have this issue because the AJAX code is hardcoded in and to make matters worse if you paginate first then the sorting does get rewritten to be AJAX, I told you it was a HACK.
But have no fear with just a little bit more effort you can make it sorting work as it should , Ajax Region Pull & Pagination
There are a few differences between the first example and the second example.
The main part being the javascript code on the pulling page (149)
On the report page (150) create a Before Header Reset Pagination Process that resets the pagination if the REQUEST is RP
On the Report Region put <clip> in the Region Header and </clip> in the Region Footer.
There are a few other ways to do this but this is the way that most closely mirrored the original example.
I have updated my Example Application Export so this is there to dig through.
Something to look forward to.
In 3.1 all of this has been fixed with the inclusion of one SUPER EXCITING new declarative report attribute.
I mean look at that! It's a thing of beauty isn't it ;) and better yet it supports all of APEX's pagination types.
EDIT: if you cut and paste the code snippet you will get all the code. I need to adjust the layout of this blog or get one of those nifty code highlighting javascript widgets.

Well something somewhere froze over because I found enough time to get an updated version of my sample application zipped up and upload.
There are some of the new examples in this export.
- Minimal tagging functionality , along with an xml file to populate the tags table.
- Examples on how to use $x_Toggle $x_Hide $x_Show on Regions.
- Javascript code to enable/disable a shuttle item.
- Example of a function to quickly check a series of values html_CheckSome(pThis,pValues,pArray)
You can download it here http://apex.oracle.com/pls/otn/f?p=11933:22.
If you like the theme , and with my visual design skills who doesn't, make sure to grab it because this will be the last export that has that particular one.
As usual make sure to read the disclaimer because I 100% stand by it.
#1 - The first rule of Tag Cloud is, you do not talk about Tag Cloud.
0 comments Posted by Carl Backstrom at 1:11 PMActually the first rule is probably require user login.
So I've been watching the usage on my tagging functionality, and it's not quite what I was hoping for. While I know people were applying and adding tags there was significant amount of people that were applying and adding tags just any old page, probably just to see the nifty AJAX effect I'm sure ;).
So I'm turning off the user initiated tagging, and going with an administrative tagging setup, which is basically just me adding them. I'm actually going to replace my breadcrumbs with this since I think it will be more useful.
User entered tags would work great if I required login to my application and then people could tag pages with personal tags that only they could see. And then the tag package could create tag weights based on that compared against the administered tags.
I will be allowing for voting on tags to change their weights on page but you can only vote on tags the administrator has entered.
Anyway I should have PL/SQL package that can be plugged into any APEX application to provide tagging functionality next week. I'm thinking I might make a package that contains the tagging/rating/comments functionality into ones package , configurable of course.
If course there is always my regular 40 hour to think of but this is much funner ;)
So as I've stated before I almost always deal with static XSL files when building my XML/XSL to FOP transformations.
When I do almost always start with one of two generic XSL files as a starter. One is a Generic Report XSL and another is a Generic Name Value Pair XSL , I've cleaned them up a bit and some commenting and put them up for everybody to try out.
To use them just upload them as a Named Column Template XSL and then apply to any APEX report, the named value pair page breaks after each row because I usually use it to create pages where there is one item with lots of detail.
You will get a very generic PDF but it can used as a base for other XSL files.
These templates also show some extra XSL features, like xsl:if or xsl:choose and xsl:attribute-set. I'll be posting some more specifics on XML+XSL=FOP transforms over the next couple weeks using these two files as examples but for you people that like reverse engineering stuff these files will immediately be useful.
A working example and files for download can be found here.
http://apex.oracle.com/pls/otn/f?p=11933:139
I suggest this site for people unfamiliar with XSL and FOP
http://www.w3schools.com/xsl/default.asp
http://www.w3schools.com/xslfo/default.asp
And I personally use XMLSpy ,one of the few Windows programs I use , for working with XML and XSL files it can directly create PDF's from an XML+XSL transform.
http://www.altova.com/products/xmlspy/xml_editor.html
So I had a couple comments on my Accordion Implementation I whipped up the other day.
http://carlback.blogspot.com/2007/06/is-for-apex-and-accordion.html
Plus someone wanted to be able to initialize with a certain pane open and also to create the Accordion based off of regions not a report. So I took all that to heart and rewrote my implementation a bit plus some extras I wanted and you get.
Report Based Accordion
http://apex.oracle.com/pls/otn/f?p=11933:130
and Region Based Accordion
http://apex.oracle.com/pls/otn/f?p=11933:131
The onmouseover interaction now has a 1/2 second delay.
The object initialization is now a bit more robust with more options. Most of them have pretty normal defaults. The one I recommend setting everytime is OpenMaxHeight as it gives a more consistent user experience.
function pg_Init(){
pAccordian = new Accordion('accordion');
/* optional */
pAccordian.OpenType = 'onmouseover'; //onclick or onmouseover default = onclick
pAccordian.OpenMaxHeight = 150; // optional but recommended max height of opened pane
pAccordian.OpenPane = 1; // open Accordian pane on init 1 based array
pAccordian.class_Item = 'item'; // set the class to collect item item nodes
pAccordian.class_Title = 'title'; // set the class that collects title nodes
pAccordian.class_Title_Current = 'title_current'; // set the class to set current title
pAccordian.class_Content = 'content': // set the class that collects content nodes
/*init object*/
pAccordian._Init(pAccordian);
}
I'll probably be playing with this some more but I wouldn't be surprised if you saw a slightly altered version end up in product, declarative of course ;) , it seems like a good fit.
Now all I have to do is figure out how to type as fast as this guy plays a real Accordion and I could get some real work done.
I had someone internal at Oracle ask for an Accordion widget in APEX. I figured everybody else code use something like this so I figured I'd build out an example in the standard place.
I think the best and easiest way to do this is to base it on a Report Row Template.
There are some caveats to this example.
The first being that #REGION_STATIC_ID# isn't properly substituted in a Report Row Template, I put it in anyway since at some point it will be. All you have to do is surround the report with element with an id or give the report itself an id , this actually isn't a bad idea as I figure most people will only want one of these per page.
The second is if you put multiple accordions on a page the row id has to be unique which is pretty easy to do in the SQL statement.
The accordian can be instatied on page load like this
pAccordian = new Accordion('accordion',true);
The first parameter is the id for the surrounding element.
The second parameter chooses between firing onmouse over (true) or onclick (false).
So here you go,
http://apex.oracle.com/pls/otn/f?p=11933:130
Enjoy
That's right people I've I have the hottest new product for the Oracle APEX community available now!
With some all new functionality but with that slick old school style.
You will receive a working AJAX based ranking system, a AJAX based commenting system (aka: shoutbox) and an reworked AJAX Collection Control (that actually works) plus many other features and enhancements.
! BUT THATS NOT ALL !
Starting with this version I'll also throw in a SQL scripts to install and deinstall all the objects needed to support this application , that's right no more hunting from page to page making sure the examples have the proper tables or procedures! You might ask yourself how can this get any better?
! WELL LET ME TELL YOU !
Sample Data! That's right not only do you get the application! Not only do you get the supporting schema objects! But if you act now you will get your very own copy of the sample data as seen on the Original OTN Sample Application
And what would you expect to pay for this? Hundreds? Thousands? No this is provided to you the people for free thats right absolutely free what can be a better deal than that!
Oh and I'll throw in a readme.txt file as well just because I like you ;)
Pick yours up today.
http://apex.oracle.com/pls/otn/f?p=11933:22
As posted here http://forums.oracle.com/forums/thread.jspa?messageID=1882652#1882652 I've updated the code for the wiki in the sourceforge project.
I'll be working on this as time permits over the next couple weeks to see if I can get it in a more workable/polished up state.
The toughest part as I've stated before is getting the Regular Expressions working right. I just don't have enough experience with them and it gives me different results depending on if I run it in sqlplus comparative to SQL Developer comparative to a PL/SQL function call in APEX. So any help or insite into this black art would be awesome.
So instead of continuing to bang my head on the wall over that (day after day) I'm going to be adding other features like a proper versioning system , file attachment to topics and better reporting and searching and organization features.
There are lies, damned lies and statistics. "Mark Twain"
4 comments Posted by Carl Backstrom at 10:16 AMI've added some statistic counter links from statcounter.com to my blog and to my OTN examples application. I'm using the free service which only tracks detailed stats on the last 100 visitors. It's pretty neat seeing some of the statistic's of how people are using my different sites.
This isn't all just for fun and games though I'm actually going to use the stats I get for something useful. People have complained (from time to time) that some of my examples aren't really step by step howto's but are more random code drops, which is what they are meant to be. But it does make sense to create howto's on the more popular examples if for no other reason than to make it easier for people just starting off in APEX or in integrating APEX with more client side features a better start.
Hopefully it will help with some of my documentation skills as well, which is why I only do code drops in first place ;).
Feel free to browse the statistic's as I've made them public. I personally like the maps of where people are accessing my site from.
Map for OTN Examples
Map for carlback.blogspot.com