Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

12.08 Linked with a Formula Field

Linked with a Formula Field

Linking a subreport with a formula lets you have more creativity for how it is linked to the main report. You can add a formula to the main report to convert the data type of a data field so that it is compatible with the field in the subreport. You can also have a formula field that is simply equal to the value of a data field in the main report. This gets around the restriction of having to use indexed fields for PC databases. Another reason for using formulas is to be able to either concatenate or parse fields so that their format matches the format of the field in the subreport.

To link with a formula field in the main report, make sure the formula field has already been created before adding the subreport object. If this has already been done, then the formula field will show up in the list of report fields. Select the formula field to link to and add it to the listbox on the right.

Once the formula field has been added, the frame at the bottom of the dialog box appears and it works the same as adding a data field: the parameter name is automatically filled in and the checkbox tells the subreport to link to the field that is listed in the dropdown box below it.

When you use the linking expert with either data fields or formulas, it defaults to filtering records that match the field you selected. But you aren’t limited to filtering your report on exact matches to the field. You can change the filter so that it performs any type of filtering on the field (e.g. less than the field, greater than and equal to the field, etc.) When you are done using the linking expert on the main report, right-click on the subreport and select Report | Edit Selection Formula | Records. You can modify the formula to fit your needs