Parameters and Image in Jasper - Apex

Dicas e truques sobre Oracle Reports Builder - modo gráfico ou modo caractere, ascii, arquivo .PRT, etc
Post Reply
carlynhos77
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 172
Joined: Mon, 24 Oct 2016 7:20 pm

Hello, good evening ... I'm creating some reports on Jasper Reports, and I'm initially with two problems, my application is in the cloud, so I create the report, I climb the file .Jasper to my repository, for my application Apex to make the call

[color=# FF40] My report [/color]
I created a query (select sequencial, nome, ... from MINHA_TABELA where sequencial = '1'), after that, I organized the fields in the Report, I did the tests, filtered the NR 1 record, everything went well, as expected ...

I compiled and climbed the .Jasper file to my repository.


[color=# FF0040] My Apex application [/color]
I am using Apex 19.2, I created a page, on a button I add the following code To call the report:

Select all

var report_server = "http://jasper.maxapex.net:8090/JasperReportsIntegration/report?_repName=INFO-ADMINISTRATIVO/rel2&_repFormat=html&_dataSource=INFO-ADMINISTRATIVO_1394" 
 
var report_name = "rel2"; 
var report_format = "pdf"; 
var data_source = "default"; 
     
var run_report = ""+report_server+"&_repName="+report_name+"&_repFormat="+report_format+"&_dataSource="+data_source+""; 
 
window.open(run_report);
The above code is calling the report without the filter ...

At the moment I compiled The report I needed to take the WHERE, otherwise I would get locked on the code = 1, according to my test.

My question is: How do I enter the WHERE into my SELECT, in the report, and the above code, do I need to pass the parameter to the report of the report ??

I found an example, as between parentheses ([color=# 0000ff] sequential = $ p {code} [/color]), I wanted a help of how to do this, both in the report and In Apex, on the call pass the parameter ...


In the same report, I need to insert an image that is saved in registration, like blob ... whenever I inform The BLOB field in the report of the report gives an error message, I watched a few videos about insert "blob" image in jasper, however, does not appear the same path and I can not see the image in the report, does anyone have a tip ??

could have two output, I use this image saved in the database, or I use the status image, because I went up to my repository ... Anyone, serves me

Thanks
carlynhos77
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 172
Joined: Mon, 24 Oct 2016 7:20 pm

So another detail, the image I need to present in the report if the tip is statistics, the image is in the same location as the report .Jasper.
carlynhos77
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 172
Joined: Mon, 24 Oct 2016 7:20 pm

Hello, good morning ...

The doubts about the parameter passage and the call call, have been solved ... only the problem remains in loading the image

I will post the solution to the report, parameter and call

in the select of my Jasper report, I created a parameter, with the description code, type string

Select all

[color=#0000FF][b] select sequencial, nome, ... from MINHA_TABELA where sequencial = $P{CODIGO} [/b][/color]


This is ready to receive the criterion that Apex will pass, to filter data determined

in my Apex application, I created a processing, activated by submitting to page (may have another way other than submitting), after submitting the page, the filter parameter is passed and a PDF is downloaded

Select all

[color=#FF0040][b]begin 
  xlib_jasperreports.set_report_url('http://jasper.maxapex.net:8090/JasperReportsIntegration/report'); 
  xlib_jasperreports.show_report (p_rep_name => 'INFO-ADMINISTRATIVO/holerite/rel2', 
                                  p_rep_format => 'pdf', 
                                  p_data_source => 'INFO-ADMINISTRATIVO_1394', 
                                  p_out_filename => 'Holerite.pdf', 
                                  p_rep_locale => 'en-BR', 
                                  p_additional_params => 'CODIGO=' || apex_util.url_encode(:p18_COD_FUNCIONARIO)); 
                               
  -- stop rendering of the current APEX page  
  apex_application.g_unrecoverable_error := true; 
end;[/b][/color]
in the additional paramentrum I mention 'code', is the field / paramenter I created in the report, then pass the criterion for him

, I will pass a links that treats about this configuration and sub-report
http://oracle-apex-book.blogspot.com/20 ... ts-in.html https://clients.maxapex.com/index.php?r ... asics.html [color=# 0000ff] (I used this) [ / color] https://community.jaspersoft.com/wiki/subreports

I hope this helps someone

now is to try to unravel this image issue
carlynhos77
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 172
Joined: Mon, 24 Oct 2016 7:20 pm

Returning to informing that I found the way to display the image, recorded in the fertilized bank, in the Jasper report ...

in my Jasper select

Select all

select sequencial, nome, LOGO_EMPRESA ... from MINHA_TABELA where sequencial = $P{CODIGO}
99]] In Dataset Query, I changed CLASS TYPE to JAVA.LONG.STRING to JAVA.AWT.IMAGE (in my case, I had to install the package JAVA.AWT.IMAGEM option to install the package this on the same screen / line)

later, in the structure of the report, I added an image element, and adjusted in the expression, putting the reference of my field, which in the case is:

Select all

$F{LOGO_EMPRESA}
.. I saved, I rode and 100%

only to appear, I'm creating a holly, with company logo, 2 sub-reports (left side salaries, right side discounts) and totalizations.

United, we have more strength!
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests