Setting a selection to be “true if blank”
ReportWriter uses selection criteria to determine which records to print in a report. If a record meets all of the selection criteria, it is printed. On occasion, you may want to select a record if a given field matches a certain value or if the field is blank or contains a value of zero. Instead of setting up two selection criteria, you can set up the first criterion and then set the “true if blank” flag. This flag makes a selection criterion evaluate to true if either the selection statement is met or the first operand is blank or zero. (It will also work on the second operand if the second operand is a question field.) This feature is very useful if your report puts up an input window with multiple question fields and you want the user to be able to enter data in any or all of the fields.
For example, let’s suppose we have a question field that is used to prompt the user to enter a customer name at report generation time. If the user enters a name, we want to compare it to a field in the file and only include records for that customer. If the user enters nothing, we want to include records for all customers. We can create a question field and then use it in a selection statement, as follows:
If we then set the “true if blank” flag, ReportWriter will select all records that match the specified name, or, if no value is entered, ReportWriter will include all records in the file.
|1.||Highlight the selection criterion in the Selection Criteria list.|
|2.||Select Selection functions > Set “true if blank”.|
This entry is a toggle, so if you change your mind, you can use it to turn the flag off again.
When a selection field has been flagged as “true if blank,” a letter S is displayed in the FLAGS column for that field in the Selection Criteria list.