I belive there are two ways to acomplish this witht he latter being best practices. 1) You could hard code it like so: String date = 14121114235959 $P{FormattedDate} = new SimpleDateFormat("EEEE MMM dd, yyyy") $P{FormattedDate}.format($P{date}) ; 2) Or you could use the JVM But the better choice would be to use the JVM like so: DateFormat.getDateInstance(DateFormat.MEDIUM, $P{REPORT_LOCALE}).format( $F{FormattedDate} ) DateFormat.getDateInstance(DateFormat.LONG, $P{REPORT_LOCALE}).format( $F{FormattedDate} ) This way it automatically reflects formatting choices already chosen by the user on his own PC.
Hello all, So after trying for some time to figure this problem out here is the solution that worked for me. I made sure I was calling said IDs in my sql. In order to make my IDs trigger for each iteration of the report I used several "Group Headers" I did this because the headers are evaluated once per cycle per-say. I then placed a sub report into the footer of said report and passed it the "Field" which is $F{ID}, thus when the sql is called upon it gives the ID found at that moment in time to the sub report. The end result is a sub report that triggers, every time the header is evaluated. I know this is a bit of a hack but ENJOY!
Hello all, For your enjoyment --- TAG LINE "Display PDF in Adobe Reader"
//DECLARE LOCATION OF YOUR JRXML FILEprivate static final String Report_Def = ******MY JRMXL FILE LOCATION ON C DRIVE*********//Resource REF example://jdbc/<your DB name>ConnectionDS //javax.sql.DataSource//Containerprivate static final String Report_DataSource = ******MY DB CONNECTION******** public String ActionButton(){ try{ //LOAD THE JRMXL REPORT TEMPLATEJasperDesign reportDefinition = JRMxlLoader.load(new FileInputStream(new File(Reprot_Def);//COMPILE THE REPORT TEMPLATEJasper Report report = JasperCompileManager.compileReport(reportDefinition);//GET THE CONNECTION TO THE DATABASEinitialContext initalContext = new initialContext();DataSourec ds = (DataSource)initialContext.lookup(Report_DataSource);//FILL THE COMPILED REPORT TEMPLATEJasperPrint print = JasperFillManager.fillReport(report, new HashMap<String, Object>(), ds.getConnection());//********DISPLAY IN ADOBE READER*********//CREATE AN OUTPUT STREAM WHERE DATA IS WRITTEN TO BYTE ARRAYByteArrayOutputStream output = new ByteArrayOutputStream();//CALL UPON THE EXPORT MANAGER TO LOAD JASPER PRINT AND BYTE ARRAYJasperExportManager.exportReportToPdfStream(print, output);//DECLARE A STRING WHERE YOU WILL SAVE THE REPORTfinal String PDF_FILE = "C;/****LOCATION YOU WANT TO SAVE THE NEW REPORT****);//CREATE A NEW STREAM AND CALL THE CONVERTED, SAVED REPORTOutputStream pdfFile = new FileOutputStream(new File(PDF_FILE));//WRITE THE PDFpdfFile.write(output.toByteArray());//CLEAN THE PDFpdfFile.flush();//CLOSE ITpdfFile.close();//RUN YOUR BRAND NEW PDF REPROTfinal String PDF_RUN = "rundll32 url.dll, FileProtocolHandaler " + PDF_FILE; //Don't forget the space between 32 and URL.//EXECUTE THE COMMANDRuntime.getRuntime().exec(PDF_RUN);}catch(Exception e){e.printStackTrace();}}