A parameter is a convenient way to filter records out of a crystal report without having to build the formula over and over each time. Typically, if we wanted to take this report and just show three departments we would come up to “Report” > “Select Expert” > “Record.” Select the field that represents the department, our operator will be “is one of” and then we would identify the three values that we wanted to see for those departments. Say “OK” and “Refresh Data” you will see that you can look at three different departments in the grouping tree.
If you have a user that is not as crystal savvy or isn’t comfortable with creating the select expert formulas then a parameter is a solution for that. To create a parameter, go to the “Field Explorer” box which is the icon under “Help” if it isn’t already showing. Select “Parameter Fields” right click and select “New.” Name the parameter and the “Type” will be “String” but there are a lot of options on the drop-down menu. The “Value Field” is the field that we are filtering against so I will scroll down and find “P_Level2” which represents my department value.
If you click on “Actions” > “Import” then you have an option of importing a list. If you have all the values within the departments then you can import that list from an outside source. You can also “Append All Database Values” which will go through and look at all the values for “P_Level2” and pull those into your drop-down box.
You have options down below that allow you to identify things such as a default value or allow custom values. This is where a person could key in their own value verses just selecting from the drop-down, or possibly allow to select multiple values which I will turn on to select more than one department. Once you have named the parameter, identified the type, selected the field you want the system to look at, populated your values using actions, and set any value options then click on “OK” and now you will see your field under “Parameters.”
Click back on “Design” and drag that field onto the header of the report. It can be placed anywhere but it can be placed in the header even if it is suppressed. Go to “Report” > “Select Expert” > “Record” and set the drop-down menu to “is equal to” to be able to select your parameter in the next field. Click on “OK” and refresh the report but click on “prompt for new parameter values.” A box appears and you can select the manufacturing, marketing, and the HR departments to create a parameter within crystal reports.