Page contents
Objective
This page contains snippets and blocks of code that are useful for editing iReport XML templates.
Assumptions
- You have full admin access to ParadigmEMS
- You are a competent user of ParadigmEMS
You have already downloaded Jasper iReport v3.0, refer to How to download and install iReport v3.0
Attention!
1. Never change the report file name
2. Only full admin users can edit reports
3. Compile before uploading a changed document
4. Make sure all elements are NOT bordered in red as that suggests the element is not positioned correctly
5. Do not move elements or fields out of their default bands
How to access iReport on Paradigm
- Log into your ParadigmEMS first.
- Click on Reports from side menu.
- Click on Report Edit, it shows a list of Reports/Letters.
- You can do a quick search for the report you need, type in the report name at the top left corner .
- Click on the pencil icon , scroll to the Report Properties section.
- Report Identifier = Report_id, please do not make any changes (refer to warning #1)
- Click on the Edit Labels (you should know where it is if you are a competent user) and scroll down to the bottom.
- Scroll to the bottom section - Report Edit: (report_id here)
- Click to download the Report that the name matches the Report identifier. Sometimes you will see more than one report, the rest are sub-reports (i.e. ReportHeader, Reportfooter).
- The report will download to your Downloads folder by default
Open a report in the Jasper iReport v3.0
- Launch iReport app by single click the iReport icon
- Click on File located on the top left corner, choose Open.
- In the pop up window, find the downloaded report by looking in the folder and click Open.
- A report has now opened, check the above Warning #3 before upload a changed document.
- Compile icon can be found at the top
Java Conditions
new Boolean($P{letterNumber}.equalsIgnoreCase("1st")||$P{letterNumber}.equalsIgnoreCase("2nd")) new Boolean ( ! $F{provider_code}.equals( "Morling" ) ) new Boolean( $V{amountDueTotal}.compareTo( new Double (0.00) ) > 0 ) new Boolean ( $V{PAGE_NUMBER}.toString() == "1" ) new Boolean ($F{chessn}!=null && !$P{unitEnrolmentEndDate}.equals("")) new Boolean ( $F{course_level}.equals("VET")) new Boolean ( $F{enrolment_status_id}.equals( "ENROLMENT_COMPLETED" ) )
Dates
new SimpleDateFormat("dd MMMM yyyy").format( new Date()) new java.util.Date(2017, 1, 1) "Teaching Period: " + new SimpleDateFormat("dd MMMM yyyy").format( $F{current_semester_name} ) new SimpleDateFormat("EEEEE, dd MMMMM yyyy").parse($P{todaysDate}) new SimpleDateFormat("dd/MM/yyyy").format($P{report_date}) "Admitted to the "+$F{course_name}+" on "+new SimpleDateFormat("MMMMM dd, yyyy").format($F{course_enrolment_start_date})
Casting
"You currently owe: $" + new DecimalFormat("###0.00").format($V{amountDueTotal}).toString() $V{PAGE_NUMBER}.toString() "Total credit points required: " + new DecimalFormat("0").format($F{credit_points_required}).toString() ( $V{gpa_total}==null ? new Double (0) : $V{gpa_total} )
Static field formatting
Inline casting of fields
"Accumulated grade point average: " + ( $V{gpa_total}==null ? "0.00" : new DecimalFormat("0.00").format($V{gpa_total}).toString() )
Uppercase
Example: $V{studentFormalName}.toUpperCase()
Text field formatting
IMPORTANT
In the Font tab of the field's Properties window, set the "is styled text" to true, and in the Markup drop down, select the "HTML" option. "Is styled text" is now deprecated but still functions.
Bold
<style isBold=\"true\" pdfFontName=\"Helvetica-Bold\"> This becomes bold </style>
Underline
<style isUnderline=\"true\" >Underline me! </style>
Italic
<style isItalic=\"true\" pdfFontName=\"Helvetica-Oblique\"> I'm leaning to one side </style>
Colour
<style forecolor=\"#0000ff\"> Colour me surprised </style>
Dot-points
+"•"
Escaping
Escaping double quote
"Thank you for your application for enrolment at Group Colleges Australia (\"GCA\") Pty Ltd trading as Universal Business School Sydney (UBSS)."
Escaping special characters
Replace "&" with "&"
"<style isBold=\"true\" pdfFontName=\"Helvetica-Bold\">" +$F{edu_other_unit_id}.trim() + "</style> (" + $F{unit_name}.replaceAll("&","&") + ")"
MSWord Entities
Replacing fancy quotes and long dash
REGEXP_REPLACE(REGEXP_REPLACE(ce.content, '&[lr]dquo;', '"', 'g'), '–', '-', 'g') as content,