ireport an introduction tec01

15
iReport An Introduction TEC01 Patty White

Upload: lucita

Post on 24-Feb-2016

75 views

Category:

Documents


1 download

DESCRIPTION

iReport An Introduction TEC01. Patty White. Agenda. Anatomy of an Aspen Report Formatting Report Fields Adding a New F ield to the Report A Taste of Java: String Methods. Anatomy of an Aspen Report . Input Definition gathers information from user. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: iReport An Introduction TEC01

iReportAn Introduction

TEC01

Patty White

Page 2: iReport An Introduction TEC01

Agenda

• Anatomy of an Aspen Report

• Formatting Report Fields

• Adding a New Field to the Report

• A Taste of Java: String Methods

Page 3: iReport An Introduction TEC01

Anatomy of an Aspen Report

Input Definition gathers

information from user

Java Source gathers data based

on user’s inputFormat Definition displays the data

gathered in Java source

Page 4: iReport An Introduction TEC01

Component File Format Preferred Editing Tool

Input definition XML(X2 design)

Edit in browser window, Notepad++, Textpad,

Notepad

Java source JavaDownload and edit with Notepad++, TextPad,

Notepad

Format definition JRXML(Jasper design)

Download and edit with iReport

Page 5: iReport An Introduction TEC01

• 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).

You can now edit report formats!

Page 6: iReport An Introduction TEC01

District View: Tools > ReportsReport 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.

Page 7: iReport An Introduction TEC01

Modify a Report Format Definition

SYS-STD-010

A system-delivered report. When you make a copy of the report, replace with a 3-character district/school code.

ADM – AdminATT – AttendanceCND – ConductGRD – Grades HTH – HealthSCH – ScheduleSTD – StudentSTF – Staff

District View: Tools > Reports

Page 8: iReport An Introduction TEC01

• 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.

Options > Copy

XXX-STD-010

Birthday List

Page 9: iReport An Introduction TEC01

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.

Page 10: iReport An Introduction TEC01

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}

Page 11: iReport An Introduction TEC01

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}

Page 12: iReport An Introduction TEC01

• 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()

Reports with get() function

Page 13: iReport An Introduction TEC01

Taste of Java String Methods• toUpperCase()

string.toUpperCase()$F{nameView}.toUpperCase()

• trim() – removes white space from both ends of stringstring.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/

Page 14: iReport An Introduction TEC01

String Comparisons• equals() and not equal

string.equals(anObject) !string.equals(anObject) $F{yog}.equals(“2010”) !$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.

Page 15: iReport An Introduction TEC01

Thank you.

[email protected]