Monday, February 15, 2010

RMOUG & MAOP 2010

Talk about a busy week ahead... I'm about to head to the airport and hop a flight to Denver, CO, where I will be presenting Troubleshooting Oracle APEX at the RMOUG 2010 Training Days. If you're in the Denver area, it's not too late to register, but you have to do it on-site at the Colorado Convention Center.

Later this week on Friday, I will be presenting at MAOP 2010, which will be held in the Oracle Reston office. There, I will be presenting a shorter version of Troubleshooting Oracle APEX as well as Extreme Makeover: APEX Edition. MAOP only has a few slots left, so be sure to register soon to reserve yours soon.

Be sure to say hello if you're at either event.

Friday, February 12, 2010

Uploading XLS Files with APEX Listener EA2

Kris Rice just posted that the APEX Listener EA2 is available for download.

Quoting Kris on the new features:

  • New /listenerAdmin with real-time statistics
  • Mechanism for logging DB Requests
  • Capability to upload .xls files into an APEX Collection

The last of these features interests me the most, as we get that request all of the time.  The de facto solution is to save your Excel data as CSV, then upload that.  Not very elegant.

So before even completing my first cup of coffee this morning, I decided to try it out.

Downloading the new listener was as snap, as was re-deploying the .war file.  Took no time at all, and I was up and running.

Next, I created a quick little application that simply had a File Browse item on the page and a button whose request value is set to 'XLS2COLLECTION', as per Kris's instructions.  I ran the application, located an XLS file, and clicked "Go".  Upon checking the session state for collections, the results were a little different than Kris outlined.

The one potentially major flaw with how its currently implemented is that the item name - not ID - of the item is used for the collection name.  Since APEX sets the item's ID to be the same as the APEX item name that developers enter, this is inconsistent and will likely cause some confusion.

One would expect that if I called the File Browse item "P1_XLS_FILE" that my collection name would also be called "P1_XLS_FILE".  This is not the case;  rather, the collection name is called "P_T01" - which if you look at the HTML source, is the item name associated with P1_XLS_FILE.

If you add additional items to the page before P1_XLS_FILE, its name will change accordingly.  Simply adding a text field with a lower sequence number than P1_XLS_FILE in my test application caused the item name to change to P_T02.

Hopefully, Oracle will address this and make it more consistent, so that we as developers can easily get the name of the collection that was just created.

Despite this flaw, this is an amazing feature, which is likely to save a lot of people a lot of time.

Just to be thorough, I also tested it with the newer XLSX format, and not surprisingly, it did not work.  Thus, be sure to save your XLS spreadsheets to the more commonly used XLS format before using this feature.

You can download my test application here.  Keep in mind that you'll also need to have the current APEX listener installed on your server for this to work.