Thursday, 8 October 2015

Creating report template in APEX 5.0

Bootstrap blog page with dynamic context

How to do this in your APEX applications?

Recently I started working with Bootstrap themes in APEX and this is a short info how to make some of the content on APEX page be retrieved by classic SQL report queries.

In our bootstrap theme there was a nicely looking page with details that we wanted to reuse, easiest way to achieve this is to create a new report template that will allow us to dynamically feed our page as classic SQL report region.

If you have a look at below bootstrap blog page that we started from

We wanted to have something like this but with multiple instances that would be drawn from our table.

To keep story short jump into Shared components select Templates -> Create template

Select Report type and give it a name that you like. Then jump back to it and edit this newly created template details.

For Before Rows in "Before first and after last row text" section set:

<div id="leftcol" class="col-sm-8 col-md-8">

and for After rows:

</div>

Reason why we did this lies in original page source code.

If you have a look of your original bootstrap theme code you will find details of how to actually do this is Bootstrap, in my example this is

In here you will notice tags starting with <article> </article>. This is what we needed to reproduce for our SQL generated reports. Similarly you have to do the same change depending on original template you started from.

Once you have done this all you have to do is create a region with a query that will contain all appropriate columns that you have used in your template.

Under attributes Template select your newly created template and you are good to go. Hope you found this useful.