TEC01 iReport - An Introduction

Report
iReport
An Introduction
TEC01
Patty White
Agenda
• Anatomy of an Aspen Report
• Formatting Report Fields
• Adding a New Field to the Report
• A Taste of Java: String Methods
Anatomy of an Aspen Report
Input Definition
gathers
information from
user
Java Source
gathers data based
on user’s input
Format Definition
displays the data
gathered in
Java source
Component
File Format
Preferred Editing Tool
Input definition
XML
(X2 design)
Edit in browser window,
Notepad++, Textpad,
Notepad
Java source
Java
Download and edit with
Notepad++, TextPad,
Notepad
Format definition
JRXML
(Jasper design)
Download and edit with
iReport
You can now edit report formats!
• iReport – visual reporting tool for JasperReports
• JasperReports – embeddable Java report library
– the report engine
• Download and install iReport 2.0.4 to your computer.
http://sourceforge.net/projects/ireport/files/iReport
(classic)/iReport-2.0.4
• Install Java Runtime Environment (JRE) if you are unable to open
iReport.
http://java.sun.com
• Launch iReport from your Desktop (outside of Aspen).
District View: Tools > Reports
Report
Engine
Version
iReport
Version
0.5 *
0.1.0
1.0.2
2.0.4
3.0.1
3.00
* Windows only (no Mac
or Linux).
Not recommended for
customizations.
Modify a Report Format Definition
District View: Tools > Reports
SYS-STD-010
A system-delivered report.
When you make a copy of
the report, replace with a
3-character district/school
code.
ADM – Admin
ATT – Attendance
CND – Conduct
GRD – Grades
HTH – Health
SCH – Schedule
STD – Student
STF – Staff
Options > Copy
• Name does not have to be unique,
but the Report ID does.
• Keep the original Report ID,
replacing SYS with 3-character
district/school code.
• Weight = priority
• Changing the version of the report
engine (JasperReports) can have
adverse effects.
• Leave the Custom checkboxes
unchecked since we are copying
the report, not modifying it.
Birthday List
XXX-STD-010
1. Make a copy.
2. Download Format Definition
.
3. Edit using iReport.
4. Upload Format Definition
.
5. Use Options > Compile Format.
6. If you get compile time errors, return to step 3.
7. Save the report.
8. To test, use Options > Run.
Or navigate to screen where report exists in Reports menu.
9. Hide original SYS- version by un-checking all views on
report’s Navigation sub-tab.
Customizing a report: adding a field
1. Determine the following:
• Is new field on report’s base table? Yes > go to step 2.
• Is new field on related table? Yes > go to step 3.
2. Add field to report’s base table.
• Specify field with Java name from Data Dictionary.
• Right-click in Document structure, and select Add.
• Enter Java name of field.
• Use this field in your report with the syntax $F{fieldName}
Sample screens show syntax $F{gradeLevel}
3. Add field to related table.
• Right-click in Document structure, and select Add.
• Specify related table, then field.
Examples:
person.genderCode
person.dob
person.lastName
person.firstName
Attendance, conduct or grades report require specifying Student table
since report is based on something else (attendance, conduct or grades).
student.gradeLevel
student.person.dob
• Use these fields in your report with the syntax $F{fieldName}
$F{person.genderCode} or $F{student.fieldB023}
Reports with get() function
• Another way of referencing fields on related tables
(not Base table of report)
• Advantage of the get() function: only need to define table
(student, person, school, etc.) in field list
$F{student.gradeLevel} = $F{student}.getGradeLevel()
$F{student.fieldB023} = $F{student}.getFieldB023()
$F{person.dob} = $F{person}.getDob()
Taste of Java
String Methods
• toUpperCase()
string.toUpperCase()
$F{nameView}.toUpperCase()
• trim() – removes white space from both ends of string
string.trim()
$F{nameView}.trim()
• substring() - returns selected block of characters.
string.substring(int beginIndex, int endIndex)
$F{person.firstName}.substring(0,1)
For a complete list of the Java string class methods:
http://java.sun.com/javase/7/docs/api/
String Comparisons
•
equals() and not equal
string.equals(anObject)
$F{yog}.equals(“2010”)
!string.equals(anObject)
!$F{yog}.equals(“2010”)
• length()
string.length()
$F{homeroom}.length()
IF/Then/Else statement
•
Comparison ? result_if_true : result_if_false
$F{homeroom}.length()==0 ? “N/A” : $F{homeroom}
If length of homeroom field = 0, print “N/A”,
otherwise print homeroom.
Thank you.
[email protected]

similar documents