Index

Parameter

A Parameter is a variable whose value is an input value at run time.  You will always need to specify a parameter when running a report.  For example, each time the report is run, the editor for the report would like to have his/her name placed in the report header section.  You simply insert a parameter directly in the report, and each time you run the report, insert the value for the editor's name.

Or you may want to input order date as an input parameter when running a report so that only orders on that date will be displayed.  That is, parameters can be used as part of the query condition (search criteria) so that only records satisfying that parameter value are retrieved.  In addition, JReport parameters can also be used for Dynamic group or sort. 

Reference Note: User's Guide | JReport Parameter and its Applications.

Parameter Properties

Data Information Properties:

Other Properties:

User Defined Format for Parameter

How does one define user format for different types of parameters?  The most commonly used are Date, Time format as introduced above. 

Date Format Syntax
To specify the time format, use a time pattern string.  In this pattern, all ASCII letters are reserved as pattern letters, which are defined as follows:

Symbol Meaning Presentation Example
G era designator Text AD
y year Number 1996
M month in year Text & Number July & 07
d day in month Number 10
h hour in am/pm (1~12) Number 12
H hour in day (0~23) Number 0
m minute in hour Number 30
s second in minute Number 55
S millisecond Number 978
E day in week Text Tuesday
D day in year Number 189
F day of week in month Number 2 (2nd Wed in July)
w week in year Number 27
W week in month Number 2
a am/pm marker Text PM
k hour in day (1~24) Number 24
K hour in am/pm (0~11) Number 0
z time zone Text Pacific Standard Time
' escape for text    
'' single quote    

Notes:

  1. The count of pattern letters determine the format.
  2. Text: 4 or more pattern letters--use full form, < 4--use short or abbreviated form if one exists.
  3. Number: the minimum number of digits.  Shorter numbers are zero-padded to this amount.  Year is handled specially; that is, if the number of letter 'y' is 2,   the year will be truncated to 2 digits.
  4. Text & Number: 3 or over, use text, otherwise use number.
  5. Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text.  For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes.
  6. A pattern containing any invalid pattern letter will result in a thrown exception during formatting or parsing.

Examples Using the US locale:

Format Pattern: "yyyy.MM.dd G 'at' hh:mm:ss z"
Result: 1996.07.10 AD at 15:08:56 PDT

Format Pattern: "EEE, MMM d, ''yy"
Result: Wed, July 10, '96

Format Pattern: "h:mm a"
Result: 12:08 PM

Format Pattern: "hh 'o''clock' a, zzzz"
Result: 12 o'clock PM, Pacific Daylight Time

Format Pattern: "K:mm a, z"
Result: 0:00 PM, PST

Format Pattern: "yyyyy.MMMMM.dd GGG hh:mm aaa"
Result: 1996.July.10 AD 12:08 PM

Decimal Number Format Syntax

Symbol Meaning Notes
0 a digit  
*  a digit, zero shows as a star Can't mix 0, *, and _ in same format
_ a digit, zero shows as a space Can't mix 0, *, and _ in same format
# a digit, zero shows as absent  
. placeholder for decimal separator  
, placeholder for grouping delimiter Shows the interval to be used
; separates formats positive and negative.
- if there is no explicit negative sign, - is prefixed "0.00" -> "0.00;-0.00"
% divide by 100 and show as percentage  
X any other characters can be used in the prefix or suffix   

Index