Finding a stray formula or parameter field

Wednesday 27 June 2007 @ 10:16 am

Crystal will not allow you to delete a formula or parameter field from a report unless that item is no longer used anywhere in the report. Unfortunately, there are several hundred places where a formula could be hidden. These include sorting, grouping, selecting, totaling and dozens of formatting formulas for every report object. Checking all of these hiding places is not practical, so here are two ways to have Crystal help you uncover where the field is being used.

My favorite method is to edit the formula or parameter in question and change it’s data type. For a numeric or date formula change the formula to “x”. If it is a character formula change it to a numeric value like zero. Then preview the report. Every formula that uses this item in a calculation will now pop up with an error message, and you can fix them one after the other.

However, the first method won’t work if the formula/parameter is just sitting on the report. You can find these items by exporting the report using the “report definition” format. This creates a text file that lists the location of all fields on the report canvas. You can search this text file for your formula name and see where it is sitting or even if it is used in another formula field. Note that conditional formatting formulas are not included in this export in version XI. Some older versions included some or most of the formatting formulas but I have yet to find a version of Crystal where ALL formatting formulas were picked up by the export.

(Update 9/6/2021 – Any recent version of Crystal allow you to right-click on a field and select “Find in Formulas”.)

(For examples of my most popular formulas, please visit the FORMULAS page on my website.)







Leave a Reply

Recrystallize Pro