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"))
Dates
new SimpleDateFormat("dd MMMM yyyy").format( new Date())
https://community.jaspersoft.com/questions/825960/how-do-i-set-parameter-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})
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()
From <https://stackoverflow.com/questions/4832133/formatting-double-into-a-string-in-ireport>
( $V{gpa_total}==null ? new Double (0) : $V{gpa_total} )
Static field formatting
"Accumulated grade point average: " + ( $V{gpa_total}==null ? "0.00" : new DecimalFormat("0.00").format($V{gpa_total}).toString() )
Uppercase
.toUpperCase()
Example: $V{studentFormalName}.toUpperCase()
From <https://community.jaspersoft.com/questions/533776/touppercase-functionality-fields>
Text field formatting
Set mark-up and confirm is styled text
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
+"•"
Casting
" <style isBold=\"true\" pdfFontName=\"Helvetica-Bold\">Total Earned Credit Points: </style>" + $V{earnedCreditPoints}.intValue()
"/var/opt/ems/nida/files/"+$F{file_name}
$P{reportSourcePath} + "/images/cairnmillar_letter_header.png"
Sample dynamic where clauses
( $P{eduProgramEnrolmentId}==null || $P{eduProgramEnrolmentId}.equals("") ? "" : " AND epe.edu_program_enrolment_id = '"+$P{eduProgramEnrolmentId}+"'" ) + ( $P{academicTermId}==null || $P{academicTermId}.equals("") ? "" : " AND tp.custom_time_period_id = '"+$P{academicTermId}+"'" ) + ( $P{courseId}==null || $P{courseId}.equals("") ? "" : " AND epe.edu_program_id = '"+$P{courseId}+"'" ) + ( $P{providerId}==null || $P{providerId}.equals("") ? "" : " AND epe.home_institution_party_id = '"+$P{providerId}+"'" ) + ( $P{studentNumber}==null || $P{studentNumber}.equals("") ? "" : " AND lsi.student_number = '"+$P{studentNumber}+"'" ) + ( $P{censusPeriodId}==null || $P{censusPeriodId}.equals("") ? "" : " AND esu.dest_census_date IN "+$P{censusPeriodId}) + /* ( $P{censusDateFrom}==null || $P{censusDateFrom}.equals("") ? "" : " AND esu.dest_census_date >= '"+$P{censusDateFrom}+"'" ) + ( $P{censusDateTo}==null || $P{censusDateTo}.equals("") ? "" : " AND esu.dest_census_date <= '"+$P{censusDateTo}+"'" ) + */ ( $P{unitEnrolmentStatus}==null || $P{unitEnrolmentStatus}.equals("") ? "" : " AND eue.enrolment_status_id IN "+$P{unitEnrolmentStatus} ) +((($P{eduProgramEnrolmentId}==null || $P{eduProgramEnrolmentId}.equals(""))&& ($P{academicTermId}==null || $P{academicTermId}.equals(""))&& ($P{courseId}==null || $P{courseId}.equals(""))&& ($P{providerId}==null || $P{providerId}.equals(""))&& ($P{studentNumber}==null || $P{studentNumber}.equals(""))&& ($P{censusDateFrom}==null || $P{censusDateFrom}.equals(""))&& ($P{censusDateTo}==null || $P{censusDateTo}.equals(""))&& ($P{censusPeriodId}==null || $P{censusPeriodId}.equals(""))&& ($P{unitEnrolmentStatus}==null || $P{unitEnrolmentStatus}.equals("")))?" AND epe.edu_program_enrolment_id='No Parameters'":"")