Jasper to apex Integration Problem with Parameter type Date

0

Hi all.

I tell you about my present problem with Apex:
Now I can run reports made with iReport in Apex. No problem except in reports that have a prompt parameter type date. In iReport I could only obtain this with parameters type String, although they were really dates. In iReport all works fine.
But in Apex i am using below code , the Input Controls (date Parameters type date in iReport) doesn't work properly. I´ve changed and create Input Controls type Date  but i am getting error (Message java.lang.String cannot be cast to java.util.Date) .

using below code in apex application.

DECLARE
   l_clob            CLOB;
   l_blob            BLOB;
   l_sql_delimiter   VARCHAR2 (30);
   l_lang_context    INTEGER        := DBMS_LOB.default_lang_ctx;
   l_warning         INTEGER        := DBMS_LOB.warn_inconvertible_char;
   l_dest_offset     INTEGER        := 1;
   l_source_offset   INTEGER        := 1;
   L_URL             varchar2(300)  :='http://192.168.15.10:8081/JasperReportsIntegration/report?_repName='; 
   l_p_rep_name      VARCHAR2 (50)  := 'report1';   --TestJava EmpATT
   l_p_rep_for       VARCHAR2 (50)  := :P3_NEW ;--'pdf';
   l_file_name       VARCHAR2 (100) := 'report1'; ---EmpATT
   l_EMP_prameter    varchar2(100) :=:EmployeeNumber;
   l_EMP_DEPT        varchar2(100) :=:Department;
   l_PROJ_MANG       varchar2(100) :=:Project_Name;
   l_FROM_DATE        varchar2(100) :=:FROM_DATE;
   l_TO_DATE        varchar2(100) :=:TO_DTAE;
   
BEGIN
   l_clob := NULL;
   DBMS_LOB.createtemporary (l_blob, TRUE);
   apex_web_service.g_request_headers (1).NAME := 'Content-Type';
   apex_web_service.g_request_headers (1).VALUE := 'application/json';
   apex_web_service.g_request_headers (2).NAME := 'Authorization';
   apex_web_service.g_request_headers (2).VALUE :=
                                           'Basic {##basic authentication##}';
   apex_web_service.g_request_headers (3).NAME := 'Accept';
   apex_web_service.g_request_headers (3).VALUE := 'application/json';
   l_blob :=
      apex_web_service.make_rest_request_b  
         (p_url              => L_URL 
                                || l_p_rep_name
                                || '&_repFormat='
                                || l_p_rep_for
                                ||'&_From_date='||l_FROM_DATE
                                ||'&_From_date='||l_to_DATE,
          p_http_method      => 'GET',   
       p_parm_name => apex_util.string_to_table('FROM_DATE:TO_DTAE'),
       p_parm_value => apex_util.string_to_table(l_FROM_DATE||':'||l_TO_DATE)--'1182:1182')
       p_parm_value => apex_json.get_date(p_path => 'FROM_DATE'
                          ,p_values   => l_FROM_DATE );
         );
   HTP.init;
   OWA_UTIL.mime_header ('application/octet-stream', FALSE, 'UTF-8');
   HTP.p ('Content-length: ' || SYS.DBMS_LOB.getlength (l_clob));
   HTP.p ('Content-Disposition: inline; filename='||l_file_name||'.'||l_p_rep_for);
   --"EXPORT.XLS"
   OWA_UTIL.http_header_close;
   WPG_DOCLOAD.download_file (l_blob);
   apex_application.stop_apex_engine;
EXCEPTION
   WHEN OTHERS
   THEN
      SYS.HTP.prn ('error: ' || SQLERRM);
      apex_application.stop_apex_engine;
END;

 

 

Any solution?

Thanks in advance

Ramuvenkiteela's picture
Joined: Jan 27 2019 - 9:48am
Last seen: 1 month 3 weeks ago

0 Answers:

No answers yet
Feedback