MaxAPEX

apex 20.2 datasets report printing

Oracle APEX Report Printing New Features

Oracle APEX has new amazing features which will now enable you to print quickly and more effectively from APEX. This is possible without having to license the Oracle Analytics Cloud to get a BI Publisher instance setup (a prior way of printing reports). New features include PDF printing, sending email, programmatic APIs, and more.  

 

Most businesses needed the ability to print and programmatically build reports dynamically. In the past, you generally had to turn to low-cost solutions such as Altova StyleVision or XSLT file generators. These programs were more/less complicated to integrate into an APEX environment and when you wanted something simpler you generally had to pay something like BI Publisher to get that pixel-perfect reporting.  

 

These new features will help you to scale your reporting capabilities quickly and dynamically. With new language support features and attachable reports to emails, you are well on your way to improving the business. Let’s take a look at some of these key new features: 

Steps to Create Your First Report 

In this demonstration, I will be working on creating a report that not only takes the data but also takes the additional highlighted and logic into account when you download a PDF or an Excel format. To begin, you can use your own APEX environment or use some good APEX Cloud Hosting provider such as www.maxapex.com. Navigate to your Oracle APEX development environment and underneath SQL Workshop Install the Countries Sample Dataset:

Once installed, proceed to create a new application in the workspace. Once that application is up and running create a new page which we will use for setting up our first report: 

Let us begin looking at this new report: 

As you can see it’s a simple report and it has the main data elements. From the Actions menu we can select:  

 

Actions > Download  

 We are then presented with a new dialog. As you can see there are a few new options. The new Data Only option is great for when you want to get the data out of the report if the user is editing the report, however what if you want the report with all the updated highlightedmarkings, etc.?

That’s the benefit of not selecting the Data Only checkbox. Let’s say that your end users need to do their own reporting and make their own highlights. With these new features, they can get that pixel-perfect report without having to request a new report built out for them 

This amazing functionality makes the built-in engine for reporting simple and intuitive for users as well as developers.  

Advanced Printing 

Now that you can see some of the amazing features that these reports offer, sometimes it’s of value to you to not have to display the report on the page, but simply have the users select maybe a few cards/options on a page, which will then create a query behind the scene and generate the report to download. To do this you can use some of the amazing features of the apex_data_export package. Here is an overview of a piece of code that allows you to highlight in a report the rows that contain the letter “G” in the name

Declare
l_context        apex_exec.t_context;
l_highlights     apex_data_export.t_highlights;
l_export         apex_data_export.t_export;
l_print_config    apex_data_export.t_print_config;
begin
apex_data_export.add_highlight(
p_highlights          => l_highlights,
p_id                  => 1,
p_value_column        => ‘HIGHLIGHT_NAME’,
p_display_column      => null,
p_text_color          => ‘Black’,
p_background_color    =>  ‘Green’);

l_context := apex_exec.open_query_context(
p_location    => apex_exec.c_location_local_db,
p_sql_query   => ‘select nationality, country_code, case when name like ”%G%” then 1 end as HIGHLIGHT_NAME
from eba_countries’ );

l_print_config := apex_data_export.get_print_config(
p_body_font_color             => ‘Black’,
p_page_header                 => ‘Country’,
p_page_header_font_color      => ‘Black’,
p_page_header_font_size       => 14,
p_page_header_font_weight     => apex_data_export.c_font_weight_bold,
p_page_footer                 => ‘Country’,
p_page_footer_font_color      => ‘Black’,
p_page_footer_font_size       => 14,
p_page_footer_font_weight     => apex_data_export.c_font_weight_bold,
p_border_width                => 1,
p_border_color                => ‘Black’);

l_export := apex_data_export.export (
p_context      => l_context,
p_format       => ‘PDF’,
p_print_config => l_print_config,
p_highlights   => l_highlights );

apex_exec.close( l_context );

apex_data_export.download( p_export => l_export );

exception
when others then
apex_exec.close( l_context );
raise;
end;

These new and amazing features in Oracle APEX will take your reports from incredible to stupendous. The ability to make reports and code the highlighted and other aggregations into PL/SQL is remarkable. As you continue to work with this package more procedures and functions will become available in subsequent releases

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x