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 highlighted,Β markings, 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