UKOUG 2010 APEX meetup!

Venue: Pennyblack’s at The Mailbox – http://www.pennyblacksbar.com

Time: Monday 29th November arrive 8:00pm – 8:30pm

Be there!

Advertisements

ExtJS and cliffs…

Okay, I haven’t posted in a very long while…

So, apologies for the delay, but such is the result of falling off a cliff!

I have mentioned a few times that I was working on some ExtJSy stuff and some people have asked me when it will be ready. Quick answer is not very soon but I would welcome you to have a look at where I’m at so far.

I took great inspiration from Mark Lancaster (I do hope you’ve seen his site), and Matt Nolan at e-DBA. The route I took was to use a PL/SQL package to dynamically (probably strecthing the use of the word there…) create the ExtJS scripts based on the meta data from the APEX tables and a bit of DBMS_SQL, a few application processes and a couple of standalone JS files in the header of the page template. It’s all pretty clean and generic.

On the home page there’s a little portal kind of thing where the positions of things are based on the region positions, columns etc. If you find the page with some grids on it – it uses the alignment, default sort settings etc. from the APEX data as well. So you just enter the report query and settings as normal in APEX and the PL/SQL package picks all of that up to create the grid.

It’s just a starting point at the moment and something I hope to work on when in finer form.

So sorry for the wait and sorry it’s only just started but here’s the link…

Munky’s Zoo

Please e-mail me with suggestions for what to do next…

New book on APEX coming soon!

Arie Geller and Matthew Lyon are nearing completion of the new book “Oracle Application Express 3.2 – The Essentials and More”, published through Packt Publishing.

I’ve had the pleasure of reviewing of this and it’s going to be essential reading for all of you getting into APEX or wanting to expand your horizons after getting to grips with the fundamentals. No spoilers here, you can check out the details on the Packt site.

Well done Arie and Matthew, nearly there!

The book is due for release January 2010

Flexible AJAX Calls In APEX – Reports

Started to get fed up sticking the same old javascript in my HTML header on lots of pages so I decided to make my report refresh call a little more generic… now I can just have it in my general JS library and call it however I want…

This is used with a background report page that is fed details by the calling page and the report region is displayed in the current page with no page submit. I generally use it for a summary report, with a ‘Details’ column link that drills down to a further report with more info. The report’s actually in another page but is displayed on the same page with no refresh.

With this function you input the page number of your target report, the name of the div that you want it displayed in on the current page and then an array of the items (could include column substitutions etc.) on the current page and an array of the items of the target page that need to be populated.

Very flexible now – you can derive the target page and even where it should be displayed, not necessarily from static calls but even by item values (checkboxes, LOVs, whatever you want!).


<script type="text/javascript">
<!--
function get_tasty_report(pTargetPage,
                          pRegionDiv,
			  pSourceItems,
			  pTargetItems){

if (pTargetPage == null) {
alert('No target page is defined');
return;
}

if (pRegionDiv == null) {
alert('No region div name is defined');
return;
}

var get = new htmldb_Get(null,$x('pFlowId').value,null,pTargetPage);

if (pSourceItems !== undefined || pTargetItems !== undefined) {
	if (pSourceItems.length != pTargetItems.length) {
		alert('Wrong number of arguments in call to get_tasty_report');
		return;
	}

	for (var ii = 0; ii < pSourceItems.length; ii++) {
		get.add(pTargetItems[ii], pSourceItems[ii]);
	}
}

$x(pRegionDiv).innerHTML = get.get(null,'<ajax:TASTY_BODY>','</ajax:TASTY_BODY>');
}
//-->
</script>

You can see a little bit of rudimentary error handling in there that you can adapt if needed or simply remove – just there to throw things out to me when I was messing about with it.

Anyway, here’s a simple example using scott/tiger

http://apex.oracle.com/pls/otn/f?p=293:6

So all I’ve done is create a

SELECT *
FROM dept
WHERE deptno = : P5_DEPTNO

report region on page 5. I’ve also added a Display As Text(does not save state) item called P5_DEPTNO. Display condition is ‘Never’.

Next, I’ve copied the Printer Friendly template and called it AJAX Report. Then I replaced the ‘Body’ definition in my new template with…

<ajax:TASTY_BODY>
<div id="TASTY_BODY">#BOX_BODY#</div>
</ajax:TASTY_BODY>

and associated page 5 with the new AJAX Report template.

This (page 5) is the background page.

Now on page 6, I have a

SELECT *
FROM emp

report region.

I’ve also created a blank HTML region with a region source of…

<div id="my_div">
</div>

Then I’ve defined a ‘Department Details’ column with this as the link…

javascript:get_tasty_report('5','my_div',['#DEPTNO#'],['P5_DEPTNO']);

Note that the source items and target items are arrays – you can stick as many in there as you like, you can even target different pages and reports and display them in different regions on your page!