Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I grep (search) a Crystal report for all uses of a column?

I am trying to remove all references to a table from a Crystal XI report. Crystal is telling me that a column from that table is currently being used, because there is a little green check mark over the field in the field viewer. Also, if I try to remove the entire table, I get a warning. The warning is almost useless though because it doesn't tell me where the field is used. Now, back when programmers were real programmers, and mice were things cats chased, I could just grep a directory or file and find all references to a variable I was interested in. But how do I do this in Crystal? I have already tried exporting the report to a Report Definition, which helped find some instances of the troublesome field. Unfortunately, that format does not include all formulas, just some. Please tell me I don't have to buy a third party app (or write my own COM thingy) just to do this seemingly simple thing.

EDIT to add details about tangential point: In case anyone is wondering, I am not crazy - I have duplicated the issue where a formula's definition does not show up in the exported Report Definition. I created a new blank report, created one formula named stealth that returns 1234. I then used that formula in the Section Expert for the details section, in the "suppress" formula, setting it to {@stealth} == 0. the use of the formula shows up, but not the definition. So when my unwanted column was used in the formula, I was not be able to find it! Here's what the rpt def looks like (after deleting some blank lines):

     Crystal Report Professional v11.0 (32-bit) - Report Definition
    1.0 File Information
     Report File: 
     Version: 11.0
    2.0 Record Sort Fields
    3.0 Group Sort Fields
    4.0 Formulas
    4.1 Record Selection Formula

    4.2 Group Selection Formula

    4.3 Other Formulas
    5.0 Sectional Information
    5.1 Page Header Section
     Visible, Keep Together
    5.2 Page Footer Section
     Visible, New Page After, Keep Together, Print At Bottom of Page
    5.3 Report Header Section
     Visible, New Page Before
    5.4 Report Footer Section
     Visible, New Page After
    5.5 Details Section
     Visible
     Subsection.1 
      Visible, Keep Together
      Format Formulas
      Visible: {@stealth}= 0

like image 895
Peter Recore Avatar asked Jul 13 '09 21:07

Peter Recore


1 Answers

If all else fails ...

File -> Export -> Export Report, then choose the Report Definition (TXT) option.

That will give you a plain-text representation of every element of the report. You can grep or CTRL-F or (insert search tool of your choice) through that. "Find in Formulas" usually works, but I've had to go the export route a couple of times, for no apparent reason.

Edit: Of course, if I'd bothered to completely read your post, I'd see that you've already done this.

Very curious.

like image 75
Adrien Avatar answered Oct 21 '22 06:10

Adrien