You are here: Reference Guide > Report Writing > Appendix C Range Parameter Formulae

Appendix C – Range Parameter Formulae

Range parameter formulae contain a number of “Keyword=Value” lines.  These lines are entered into the formula as comments so that Crystal Reports ignores them (but Jiwa knows to act upon them).  Therefore, a typical line inside a range parameter formula would look like “//Keyword=Value” (without the surrounding quotes).

Below is a list of all of the keywords that Jiwa will recognize and act upon, if found inside a range parameter formula.

Keyword

Meaning

Caption

The value (remember the format is Keyword=Value) is used as the description for the range parameter, and is presented to the user alongside the range parameter when the report is loaded.

Possible Values:

Any text

Example:

//Caption=Select Starting Part No.

Type

This defines the basic type of the range parameter, such as string or number.  This affects the values accepted by the formula (i.e. “a” is not valid for a “Type=Number” formula), and also the way the parameter is presented to the user in the ranges grid of the report screen.

A full description of possible “Type” values is given in the table below this one.

Possible Values:

String

StringCombo – Depreciated, do not use.

Number

NumberCombo

Date

CheckBox

Example:

//Type=String

Search

The value may be “Yes” (case insensitive) or non-yes, or the keyword may not be used in the formula at all (which implies non-yes).  If the value is the string “Yes”, a clickable button is enabled alongside the range parameter value on the screen.  When this button is clicked the Jiwa search screen is launched.  The contents of the search screen and how the results of the search screen will be used are determined by the inclusion/values of other keywords (i.e.”Select”, “Order”, and “Default”). 

Possible Values:

Yes

No

Any text (this implies that this range parameter value is NOT Jiwa searchable)

Example:

//Search=Yes

Select

If the range parameter has been defined as a searchable one (i.e. “//Search=Yes”), then the value for this keyword is combined with the value for the “Order” keyword (if one exists) to build the T-SQL Query string used by the search screen. 

The first item in the SELECT clause is what is returned to the ranges grid when a selection is made from the search screen.

Possible Values:

Any valid T-SQL query that excludes the ORDER BY clause (Ordering is handled by a separate keyword, “Order”).

Example:

//Select=SELECT PartNo, Description FROM IN_Main

Order

If the range parameter has been defined as a searchable one (i.e. “//Search=Yes”), then the value for this keyword is combined with the value for the “Select” keyword to build the T-SQL Query string used by the search screen.

Possible Values:

Any valid T-SQL ORDER BY clause (including the “ORDER BY” syntax itself).

Example:

//Order=ORDER BY IN_Main.Partno

Min

If the range parameter type is numeric (i.e. Type=Number), then the value for the “Min” keyword dictates the smallest number that the user is allowed to input.

Possible Values:

Any numeric value.

Example:

//Min=0

Max

If the range parameter type is numeric (i.e. Type=Number), then the value for the “Max” keyword dictates the largest number that the user is allowed to input.

Possible Values:

Any numeric value.

Example:

//Max=100

Decimal

Controls the number of decimal places to allow in the range parameter.

Possible Values:

Any positive numeric value.

Example:

//Decimal=2

Add

This keyword is used to add values to a combo box type range parameter (i.e. //Type=NumberCombo).  A formula may contain several “Add” lines.

Possible Values:

Of the form X, Y Where X is a positive integer, and Y is a string.

Example:

//ADD=1,Classification

//ADD=2,None

Default

The default value that should be used as the formula value.  Depending on the “Type” of the formula, this value may be text, a number, or a T-SQL statement.

There are some special keywords that can be used as the value for the “Default” keyword to represent a varying value (i.e. the current date).  These special keywords are:

LoginDate – Format(Database.SysDate, "dd/mm/yyyy")

MachineDate – Format(Now, "dd/mm/yyyy")

Today - Format(Database.SysDate, "dd/mm/yyyy")

There is also a special function that can be used for date calculations:

DateAdd – Resolves to the result of DateAdd(DateInterval, DateNumber, DateBase).  This works the same way as the DateAdd function in Visual Basic.  Possible values for the DateInterval are:

yyyy - Year

q - Quarter

m - Month

y - Day of year

d - Day

w - Weekday

ww - Week of year

h - Hour

n - Minute

s - Second

Possible Values:

Any text

LoginDate

MachineDate

Today

DateAdd(X,Y,Z) (Where X is a valid VB DateAdd “interval”, Y is amount to add, and Z is the date which the DateAdd operation is being performed on).

Examples:

//Default=DateAdd(“m”,1,Today)

//Default=SELECT PartNo FROM IN_Main ORDER BY IN_Main.PartNo ASC

//Default=Today

//Default=1

//Default=Enter some text here...

Hidden

If this Keyword exists and has a value of True (case insensitive), then the range parameter will not be presented to the user for input.

Possible Values:

True

False

Example:

//Hidden=True

These are the different range parameter types that Jiwa supports:

Type

Description

String

A simple text box.

StringCombo

Depreciated.  Do not use.

Number

A simple number box.  Formatting such as the number of decimal places to display is controlled by other keywords such as “Decimal”.

NumberCombo

A dropdown combo box from which the user may select 1 item.

Date

A date of the format dd/mm/yyyy.

CheckBox

A two state clickable box (tick or no tick).

Below are a series of sample range parameter formulae – these samples cover each of the different types.  For further examples, open up the standard reports that ship with Jiwa and browse the report source code.

String

//Type=String

//Caption=Enter your name:

//Default=

 

//Type= String

//Caption=Select Starting Part No.

//Search=YES

//Select=SELECT PartNo, Description FROM IN_Main

//Order=ORDER BY IN_Main.Partno

//Default=select PartNo FROM IN_Main ORDER BY IN_Main.PartNo ASC

''

 

//Type= String

//Caption=Select Ending Part No.

//Search=YES

//Select=SELECT PartNo, Description FROM IN_Main

//Order=ORDER BY IN_Main.Partno

//Default=select PartNo FROM IN_Main ORDER BY IN_Main.PartNo DESC

''

Number

//Type=Number

//Caption=Please enter number of days

//Default=5

 

//Type=Number

//Caption=Please enter number of hours

//Default=5.5

//Decimal=2

NumberCombo

//Type = NumberCombo

//Caption = Select Grouping

//ADD=1,Classification

//ADD=2,None

//Default=1

1

Date

//Type=Date

//Caption=Enter Start Date

//Default=Today

 

//Type=Date

//Caption=Enter End Date

//Default=DateAdd(“m”,1,Today)

 

//Type=Date

//Caption=Enter transaction date

//Default=01/01/2009

 

//Type=Date

//Caption=Enter transaction date

CheckBox

//Type = CheckBox

//Caption = Show 0 Value Rows

//Default=0

0

Copyright © 2012 Jiwa Financials. All rights reserved.