Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Optional Parameters

Status
Not open for further replies.

IceRuby

Technical User
Jan 20, 2004
85
AU
Is it possible to have optional parameters?

For example:- Product number may be mandatory parameter, however date range may or may not be applied.

If so how is this done?

Thanks in advance
 
Try presetting a value for the date range, such as 1/1/1970, then use something like the following:

(
If minimum({?MyDate}) <> cdate(1970,1,1) then
{table.date} = {?MyDateParm}
else If minimum({?MyDateParm}) = cdate(1970,1,1) then
true
)
and
(
{table.product} = {?MyProductParm}
)

Note that the full ELSE IF....TRUE qualification helps to assure SQL pass through so don't shortcut this.

-k
 
you really don't say WHY you want this parameter to be optional.

SV has given an excellent instruction for when you want to limit records. However another use of parameters is to control the Grouping of a report.

For example sometimes you may wish the report to be grouped by date as a secondary grouping and sometimes not.

Eg

Group 1 (by {Table.product})
Group 2 (by {Table.date} or no grouping...user option)

For this situation we would create the following grouping formula (using SV's format for the date parameter)

//@Group2

If minimum({?MyDate}) <> cdate(1970,1,1) then
totext({table.date},&quot;yyyyMMdd&quot;)
else
&quot;No Group&quot;;

We convert the date to a string so we can have a string value constant if no grouping is desired.

Now in the Group header and footer we want to suppress these sections so in the Section Expert for the Group 2 header and footer in the conditional suppress we place the formula

WhilePrintingRecords;
{@Group2} = &quot;No Group&quot;;




Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top