Wednesday, April 29, 2009

Returning a Value from a Popup Page

I just ran into a situation where I needed to pass back a value from a pop-up page to a tabular form item in the calling page. While I've done this in the past ny manually writing all of the JavaScript, I thought that I'd take a look at the new documented APEX JavaScript APIs.

I came across this function in the APEX 3.2 API Reference Guide (Part #E13369-01):

$v_PopupReturn(pValue, pThat)
Sets the value of the item in the parent window (pThat), with (pValue) and then
closes the popup window.
Return Value
Not applicable.
Parameters
pValue (string)
pThat (DOM node | string ID)

Looks perfect!  In addition to passing the value back, it will also close the pop-up page, even though that is not documented.

On the pop-up page, I created a link with an Optional Redirect to URL, and put the following in the link:

javascript:$v_PopupReturn(#EMPNO#, '&P3_NODE.')

P3_NODE is the DOM ID of the tabular form item that I wanted to return the value to.  You'll need to make sure that it's formatted properly for this to work.  Thus, I am passing in a "1", but returning "f03_0001".  A simple computation can do the trick.

Since we're using a built-in tabular form, we need to put the calling JavaScript in the Element Attributes of the item that we want the popup form to set.  I used this:

onclick="popUp2('f?p=' + $v('pFlowId') + ':3:' 
+ $v('pInstance') + '::::P3_NODE:#ROWNUM#',250,600);" readonly

This will pop open a new window, based on page 3 of my application.  It will also grab the Application ID and Session ID from the DOM and use those in the link, so that we preserve our session state.  Finally, it will pass along the corresponding ROWNUM of the item that we clicked on to the item P3_NODE - where I will make the proper transformation with the computation on Page 3.  Lastly, the readonly option prevents users from making direct changes to the item.

Point taken from this - have a look at the APEX API guide before you embark on writing your own code.  There are a number of helpful functions there than can save a lot of time and hassle.

Tuesday, April 21, 2009

APEX on Mac OS X - Update II

After two days of consistent use, APEX on OS X has performed flawlessly! And it's fast - REALLY fast! Sure, there's no network there to slow things down, but when using Safari 4, it's just as fast as static pages!

Now that Oracle runs natively on OS X, I can stop relying on VMs for that service, and use SQL Developer, Firefox and other Mac tools for 100% of my development.

I just hope that the folks at Oracle make this a supported configuration at some point so that we don't have to keep running in an unsupported fashion.

Thursday, April 16, 2009

APEX on Mac OS X - Update

It seems as if the Embedded PL/SQL Gateway is a part of Oracle 10g for Mac OS X after all. Thus, if there's an EPG, then there's a way to get APEX up and running.

Alex Gorbachev has posted a step-by-step guide on how to do just this here. And if you missed his Installation Guide for Oracle 10g on Mac OS X, you can find that here.

As he stated, the workaround is not a very secure thing to do; however, if you're just using it for local development, there should be no major issues. You have been warned.

In any case, I did have an issue with the code that he had posted to disable the security on XDB. After some searching around, I used the following instead:

DECLARE
configxml SYS.XMLType;
configxml2 SYS.XMLType;
BEGIN
-- Get the current configuration
configxml := DBMS_XDB.cfg_get();

-- Modify the configuration
SELECT INSERTCHILDXML
(xdburitype(
'/xdbconfig.xml').getXML(),
'/xdbconfig/sysconfig/protocolconfig/httpconfig',
'allow-repository-anonymous-access',
XMLType('<allow-repository-anonymous-access
xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">
true</allow-repository-anonymous-access>'),
'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
)
INTO
configxml2
FROM
DUAL;

-- Update the configuration to use the modified version
DBMS_XDB.cfg_update(configxml2);
END;
/
A couple other notes: you'll have to also copy the images over to the database via XDB. You can map this drive via Mac OS X and then just copy the images over via the finder.

To do this:

1) From the Go menu in the Finder, select Connect to Server...
2) For the Server Address, enter: http://localhost:8080 and click Connect.
3) When prompted, enter XDB for the user and the corresponding password.

At this point, you should see the localhost volume on your desktop. Simply create a top-level directory called i and then copy the APEX images folder into that directory, and you should be good to go with APEX on Mac OS X!

Wednesday, April 15, 2009

New APEX "video"

The Oracle APEX team has released a new video that really does a good job covering how you can position APEX.  It's more of an animation than a video, but the visuals really do a nice job complementing the concepts that they are trying to get across.

Have a look at it on the APEX OTN Site.

Monday, April 13, 2009

RTFM

No, this is not another rant about just anyone who doesn't know how to read manuals.  It's about me.  And I don't know how to read manuals.

After downloading Oracle 10g for Mac OS X, I spent some time getting it installed.  After a false start (where I created the dba group with GUID 201 - the same as the Guest account on Mac OS X), I managed to get it up and running.  There's an excellent guide here, which walks you through just what you need to do and little more:  http://blog.rayapps.com/2009/04/12/how-to-install-oracle-database-10g-on-mac-os-x-intel

Once I could SQL*Plus into the database, I downloaded the Companion CD, and started to install that, thinking that the Oracle HTTP Server would be a part of it.  Well, much to my disappointment, it was nowhere to be found.  After some digging on the OTN Apple Forum, I came across this post:  http://forums.oracle.com/forums/thread.jspa?threadID=654233&tstart=0&start=15

The important line in that post points here:  http://download.oracle.com/docs/cd/B19306_01/relnotes.102/b25285/toc.htm

And if you look at Section 2 - Unsupported Products, you'll notice that Oracle APEX & Oracle HTTP Server are definitely not alone.  In fact, here's the complete list:
  • Oracle Real Application Clusters (Oracle RAC)
  • Oracle Clusterware
  • Automatic Storage Management (ASM)
  • Network File System (NFS)
  • Network-attached Storage (NAS)
  • Raw devices
  • Oracle Application Express (formerly known as Oracle HTML DB)
  • Oracle HTTP Server
  • Oracle Workflow
  • Oracle Enterprise Manager Database Control
  • Oracle Management Agent
  • Pro*Fortran
  • Pro*COBOL
  • iSQL*Plus
  • Oracle Ultra Search
Thus, all was for almost nothing, as a database is just not a database, unless it has APEX in it.  I suppose I'll just wait it out, hoping that at least APEX & the HTTP Server make their way into the next release, which doesn't take as long as the first!

Friday, April 10, 2009

Oracle on Mac OS X Intel!

After many false starts, it looks like Oracle has finally released the Oracle Database 10g & the Companion CD for Mac OS X Intel!  Sure, it's not Oracle 11g, but I'll take what I can get...

Of course, I am going to get APEX up and running on it as soon as I can, and will report my findings. 

You can download it from OTN here:

http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10204macsoft_x86-64.html

Friday, April 03, 2009

Want $200?

No, I'm not writing stimulus checks, nor did I win the lottery. However, if you're going to ODTUG Kaleidoscope this year, you can save a quick $200 by registering before April 7th!

There's going to be two separate APEX tracks this year, in addition to the Sunday Symposium. There's just no other place that you can go to get this much APEX information for even close to the same price!

Have a look at the agenda and hope to see you in Monterey!