Quantcast
Viewing latest article 2
Browse Latest Browse All 4

Oracle Forms 11g and Apex using external events

I remembered an old post of Roel Hartman where he integrated a form into apex.
He used a part of OraFormsFaces by Wilfred van der Deijl: the CommunicatorBean.
Using this CommunicatorBean forms could react on “external messages”.
Now with Forms 11g reacting on external events, this CommunicatorBean isn’t necessary any more(sorry Wilfred).

This is how I did it using external events…
First things first: set up the advanced queueing mechanism.
Check this tutorial which includes setting up advanced queueing.
I created a little form based on emp(nothing fancy)…
Image may be NSFW.
Clik here to view.

The new feature in forms:
Image may be NSFW.
Clik here to view.

With the following properties:
Image may be NSFW.
Clik here to view.

What should forms execute when this event happens?
This has to be specified in the When-event-raised trigger.
Image may be NSFW.
Clik here to view.

In this case we retrieve the payload and extract the empno from it.
The empno is used to set the default where clause on the block.
When there’s an empno on the queue, forms will query that employee.
That’s all for the forms part…
Now I created a little Apex page with two regions:
Image may be NSFW.
Clik here to view.

The Employee details will be our form.
So I put our form in the HTML using an iframe:
Image may be NSFW.
Clik here to view.

Using a “select list” it’s possible to select an employee.
Image may be NSFW.
Clik here to view.

This is the result:
Image may be NSFW.
Clik here to view.

Now the purpose of the select list is to choose an employee and show the detail information in our form.
In order to do this, the select list calls a javascript function.
Image may be NSFW.
Clik here to view.

This javascript function is created in the HTML header
Image may be NSFW.
Clik here to view.

The code behind this:

<script language=”JavaScript” type=”text/javascript”>
function getEmployee (){
var emp = $x(‘P2_EMPNO’);
// send request
var ajaxRequest = new
htmldb_Get(null,&APP_ID.,’APPLICATION_PROCESS=get_emp’,0);
ajaxRequest.add(‘P2_EMPNO’,emp.value);

// get response
ajaxResult = ajaxRequest.get();
ajaxRequest = null;
}
</script>

This javascript function calls an application process and uses the empno as parameter.
The application process put the empno on the queue.
Image may be NSFW.
Clik here to view.

When changing the select list, the form is queried
Image may be NSFW.
Clik here to view.

This is a solution to integrate forms into another application whether it’s Apex, ADF or another web applicaton.
When it can put something on the queue, forms can react on it.
And yes, I could do it using the javascript feature in Forms 11g. I know…
And for Apex it’s probably a better solution, as we can skip the AQ part and make calls to and from forms in Javascript.


Viewing latest article 2
Browse Latest Browse All 4

Trending Articles