Translate

Donnerstag, 4. März 2021

Jasper Reports Studio 6.16 - tipps

We are presently extensively using Jasper Reports Studio 6.16 and JR Server installed at Maxapex.

Insert SYSDATE in report:

1. define a variable
2. enter in "expression" : new SimpleDateFormat("dd/MM/yy").format(new Date())
3. put the variable as a field on the report

or try to insert from the "Current Date" from the "Composite Elements" (right hand).

a textfiled will be generated [new java.util.Date()] and the standard format (pattern) is: MMMMM dd, yyyy

if you like adjust the date format, you can use --> Textfield --> pattern --> and an editor can be opened and you may choose from various formats

Generic procedure:

in my previous project I always had defined the pl/sql process on respective pages - now, as we will have more reports to produce I have defined a generic procedure in the database reading as follows:

CREATE OR REPLACE PROCEDURE JASPER_GENERIEREN 
(
  Q_PARAMETER IN VARCHAR2,  -- used for ID of a dataset
  REPORT_NAME in VARCHAR2   -- used for the report name
) AS 
  l_additional_parameters varchar2(100);
begin
-- set the url for the j2ee application
-- better retrieve that from a configuration table
--  xlib_jasperreports.set_report_url(:G_REPORT_URL);
   xlib_jasperreports.set_report_url('jasper.maxapex.net:8090/JasperReportsIntegration/report'); 
-- construct addional parameter list
l_additional_parameters :='PARAMETER01='||PARAMETER01;
-- call the report and pass parameters
xlib_jasperreports.show_report ( 
    p_rep_name     => 'XXXXXX/'||REPORT_NAME, -- Replace your Workspace name
    p_rep_format   => 'pdf', 
    p_data_source  => 'XXX_A123456_1234', -- REPLACE !!
    p_out_filename => 'Dokument_'||REPORT_NAME||'.pdf',
   --    p_rep_locale   => 'de_DE',  -- this is optional
   --    p_rep_encoding => 'UTF-8',  -- this is optional
   p_additional_params => l_additional_parameters);
   -- stop rendering of the current APEX page
  apex_application.g_unrecoverable_error := true;
  end JASPER_GENERIEREN ;

Within the APEX page no. 16 I defined a button, which calls the pl/sql process namely:

JASPER_GENERIEREN(:P16_ID,:P16_AMS_DOK_NR);

on the page it looks like:













Assuming one like to save the report in a table straight away.... - the next tipp will contain that procedure...


Keine Kommentare:

Kommentar veröffentlichen