The most common use for parameter fields is in the selection formula, where they are used to filter the records. So if I have a parameter called {?State}, I can use it in the selection formula like this:
{Customer.State} = {?State}
But what if the user wants to be able to select ALL states? If the user enters the word “ALL” in the State parameter with the selection formula above, the query would look for records with a state value of “ALL”, and likely wouldn’t find any. But you can modify the formula to read:
( if {?State} = “ALL”
then True
else {Customer.State} = {?State} )
With this selection formula, the user can enter the word “ALL” and will get ALL states (including those that are blank and null).
Note that this rule is contained in a pair of parens. Those are only strictly necessary when there are other rules in the selection formula but it is safer to add them so they aren’t forgotten. Without the parens a rule that follows the logic above will be considered part of the else and won’t be applied all the time.
One other note. This works for string fields. If your field is a numeric or date your options are to:
- Make the parameter a string so you can enter “ALL” and then convert entered values in the selection formula to the correct data type.
- Use a unique number (e.g. 99999) or a unique date (e.g. 1/1/2001) as your “All” value.
- Make the parameter an optional parameter and then have the blank value represent “All”.