Using Boolean Parameters
Boolean parameters are unique from the other parameter types because they can only hold one of two values and they can be grouped together. With other types of parameters, you can list many possible choices in its list of values. But Boolean parameters don’t let you decide the list of values.
Although the possible values are always True and False, you aren’t required to display True and False to the user. You can present the user with a better prompt by changing the Description of each parameter. For example, a report that optionally formats low inventory items in red could have two prompts which say: “Highlight low inventory items” for True and, “Don’t show inventory alerts” for False. Changing the description makes it easier for the user to understand what the report is asking for. The following figure shows a parameter that displays Yes and No rather than True and False.
Figure 4-9. Entering a Boolean parameter value.
Grouping Boolean Parameters
Boolean parameters have an optional property called Boolean Group #. This property lets you associate different Boolean parameters within a group. By grouping Boolean parameters together into different categories you get more options for how the parameters are displayed to the user and how they work together.
There are two ways to specify a Boolean group: Non-Exclusive and Exclusive. The non-exclusive group says that all or none of the parameters can be set to True. By definition, since this is a non-exclusive grouping, then there are no limits to how many parameters can be set to True. For example, a report can have certain features enabled or disabled and the user selects which options she wants to see. The user can select no options, one option, or multiple options. No parameter excludes the other parameters from being selected.
Since the user can specify one or all of the parameters within the group to be True, this really isn’t any different than just creating individual Boolean parameters. But there are a couple of benefits to using non-exclusive Boolean groups over individual parameters. The first is that by grouping the parameters into a single area, it makes it clear to the user that all the parameters are logically related to each. The second benefit is that there is only one prompt for all the parameters. If they weren’t included in the same group, then you would be multiple prompts with very redundant information Putting related Boolean parameters into the same group makes it easier for the user to understand what she is selecting. The next figure shows an example of a parameter that lets the user choose which sensitive fields should be hidden so that people reading the printed report don’t see this information.
Figure 4-10. Entering a Boolean parameter that uses a group number.
Setting the grouping properties of a Boolean parameter is done in the Options dialog box. When a parameter’s data type is set to Boolean, two new properties appear at the end of the Options list: Boolean Group # and Exclusive Group. If you want the parameter to be in a group, then enter a group number in the option Boolean Group #. The group number is an arbitrary number that you make up and you have to make sure you keep it consistent so that the proper parameters are put into the right group. If you want the group to be a Non-Exclusive group, then enter the value False in the Exclusive Group option. Enter True to make it an Exclusive group (discussed next).
An exclusive group only allows one parameter within the group to be set to True. All the other parameters must be false. The parameter names are displayed in a dropdown list and only one item can be chosen within the dropdown list. For example, a sales report could group the data based on a single field and the user gets to choose which field that is. You could prompt the user to specify whether the report should be grouped by Sales Manager, Sales Person, or Region. Thus, this is an exclusive group. The next figure shows an example of an exclusive group that prompts the user for the field to group by. The dropdown list shows all three parameters and the user can only select one of them.
Figure 4-11. Entering a Boolean parameter that is in an exclusive group.
Looking at the above figure, you should notice a few unusual aspects of it that differ from the typical parameter prompts we’ve seen so far. First, notice that in the top right corner it shows the group number. This is normally where the parameter name is displayed. Personally, I don’t think many users care about the parameter number in which this group belongs. Secondly, notice that the prompt text is very generic. This is because every parameter group always shows the same prompt text. Even if you specify the prompt text in the Options area, this is ignored by Crystal Reports and it never gets displayed. Lastly, notice that the values in the dropdown list are actually the parameter’s names. If you enter a description in the list of values, it gets ignored. Since both the prompt text and the description properties are ignored for Boolean groups, you have to make sure you name the Boolean parameter in such a way that it will make sense to the user when it is shown in the dropdown list.