Step by Step Tips - 3 methods to modify Formulas in multiple Crystal Reports at the same time

Announcement: .rpt Inspector Professional Suite and .rpt Inspector Enterprise Suite are now in End Of Life (EOL) status.

.rpt Inspector Online, a new FREE cloud / SaaS product is now available
read more about it and try it out by visiting: https://rpt.inspector.tools

.rpt Inspector Online runs in modern browsers (Mozilla Firefox and Google Chrome are supported, Internet Explorer support may be offered later) and supports Windows 7, Windows 8.1, and Windows 10 as well native support for Crystal Reports 2016 down to Crystal Reports 8.5 reports.

For the tips below, it is assumed that you've opened all the reports that contain the formulas you want to work with.

Method 1

I. Select the reports you want affected.

You can do this by either selecting them on the Objects Pane - Reports tab or on the Reports Tree.

Note: Throughout the product, there are context sensitive right mouse click pop-up menus. For example, can quickly select all reports on the Objects Pane - Reports tab by right clicking on the grid on this tab to reveal a pop-up menu and then clicking on "Select All" or using the keyboard accelerator keys "Ctrl A" to do the same.

II. Go to the Objects Pane - Formulas tab.

III. Click any formula in the grid of the Objects Pane - Formulas tab to have its properties displayed in the Properties Pane for the formula.

IV. Click on the Definition Name property label in the Properties Pane and drag and drop this property to the grid on the Objects Pane - Formulas tab to create a new column in this grid called Definition Name.

V. Right click on the newly created column Definition Name and select Group by Definition Name from the pop-up menu.

This will create a powerful pivot like grouping of all the formulas across the selected reports based on the contents of the Definition Name property. Each duplicate formula will be grouped together. If a formula is not 100% identical to another formula, it will be placed in its own grouping.

VI. Tick to select (click in the check-box) off the newly created grouping(s) that you want to be affected.

VII. Expand one of the selected grouping(s) and click on the Definition Name to have the properties displayed in the Properties Pane.

VIII. On the Properties Pane | Definition Name property, click on the ellipse "..." to open the Formula Editor dialog and modify / edit / or paste the formula you want to be applied to all the selected items of the grouping(s).

Method 2

I. From the Edit menu, select Search and Replace

II. In the Search For: edit box, type or paste the partial or full contents of the formula you want to change.

III. In the Replace With: edit box, type or paste the formula you want to replace with.

IV. In the Objects to Include grid, tick on the Formula object.

V. Click on Replace or Replace All to start the process.

Note that Search and Replace works on all Open reports, not just the ones selected.

Method 3

This method is a variation of Method 2 in that it uses the same Search and Replace but with Pattern Matching (Regular Expressions).

Say that you have the following formula in one or more reports:

if Month({Account.Statement Date})=3 then "Q1"
else
if Month({Customer.Statement Date})=3 then "Q1"
else
if Month({Financials.Statement Date})=3 then "Q1"
else
if Month({Financials.Statement Date})=6 then "Q2"
else
if Month({Financials.Statement Day})=6 then "Q2"
else
if Month({Financials.Statement Date})=9 then "Q3"
else
if Month({Financials.Statement Date})=12 then "Q4"

And you wanted to change all occurrences of Financials.Statement Date to Financials.Account Day. This could be a long and tedious task without our Pattern Matching system.

I. From the Edit menu, select Search and Replace

II. In the Search For: edit box type the following regular expression:
  (Month\({Financials).(Statement Date)

III. In the Replace With: edit box, type the following regular expression:
  $1.Account Day

IV. In the Objects to Include grid, tick on the Formula object.

V. Be sure to tick on Use Pattern Matching in the Search Options.

V. Click on Replace or Replace All to start the process.

Note that Search and Replace works on all Open reports, not just the ones selected.

For a more information on using pattern matching symbols click here.