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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making Paramaters Optional 1

Status
Not open for further replies.

fmrock

Programmer
Sep 5, 2006
510
US
Hey everyone, I am using CR9 and have a request to make a report with a bunch of paramaters. Sometimes only using only 1 or 2 out of maybe 7 or 8 different paramaters. They can be all types.

How do you all handle requests like this? How do you do this?
 
hi fmrock,

if you want to parameter as a optional,
then you sould declare that parameter type is STRING.

then only user can leave blank that parameter.

let me know it works or not for you..

thanks.
 
Hi,
You can also set default values for those that may not ne used and test for that value in the selection criteria.
Sort of like this, test for the default value, which means that it was not selected by the user, of some other value which must have been supplied by the user, and take appropriate action
This way the parameter can be of any type.
Code:
(
If [?para1] = 0 then
True  [COLOR=green]  // this means no record screening for this parameter[/color]
else
{table.Field} = [?para1]
)

and
(
....
)




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
As above - create your parameter and then test for the default value.

//{?Parameter1}
1 - Not Applicable
2 - Last year
3 - This year

//{?Parameter2}
1 - Not applicable
2 - Surname in A - M
3 - Surname in N - Z

in selection criteria:
//Check param 1
(
if {?Parameter1} = 1 then
true else
if {?Parameter1} = 2 then
{table.date} in yeartodate else
if {?Parameter1} = 3 then
{table.date} in lastfullyear
)
and
(
if {?Parameter2} = 1 then
{table.surname} > '' else
if {?Parameter2} = 2 then {table.surname}[1] in ['A' to 'M'] else
if {?Parameter2} = 3 then {table.surname}[1] in ['N' to 'Z']
)
and
etc etc ...

'J

CR8.5 / CRXI - Discovering the impossible
 
How would you do it if the Paramater was a Date Range Type. What would you set your default value to?
 
You could set the defaults of the start and end date of the range to some unlikely date, e.g., 2999-1-1, and then use a formula like:

(
if minimum({?daterange}) = maximum({?daterange}) and
minimum({?daterange}) = date(2999,1,1) then
true else
{table.date} = {?daterange}
)

-LB
 
Thanks lbass.

How come sometimes you can check the use null check box on the paramater to not include it and sometimes its not there. I have not noticed what puts it there or takes it off.
 
Sorry, I don't have CR 9 and am not familiar with that feature.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top