views:

925

answers:

4

Hello I have a number of crystal reports in my VS2008 project.

I am making a change to a couple of my database tables and want to ensure that I make all the necessary changes to the reports. I have done a standard VS search for the specific stored procedure that is being used and it found no results. However, when I went into a report and looked at the "Select Expert" I saw that the procedure is in fact being used.

Is there a way to easily search all the reports for this procedure (and others)? Or do I have to go into every single report and check?

Thanks,

A: 

Do the old ctrl-shift F, search entire solution and make sure the search filetypes includes the extensions for your report files, this is either in VS studio options or in the search window that popped up. Aslo make sure you haven't selected a case sensitive search and good luck

Robert
Unfortunately this doesn't work :-(
Nathan Koop
+1  A: 

This is a part of the VB proc I built to generates the list of all tables used by my reports. Reports are listed in a 'reports Table', and I use a memo field to store the name of all used tables. It is then quite easy to update all requested reports once tables have been modified.

Public function tablesUsedByAReport(myReportName as string) as string
Dim m_report As CRAXDRT.Report, _
      m_crystal As CRAXDRT.Application, _
      m_tablesUsedByAReport As String

Dim m_table As CRAXDRT.DatabaseTable, _
      m_section As CRAXDRT.section, _
      m_objet As Object, _
      m_subReport As CRAXDRT.SubreportObject

Set m_crystal = New CRAXDRT.Application
Set m_rapport = m_crystal.OpenReport(m_nomRapport, 1)

'table names in the report'
For Each m_table In m_rapport.Database.tables
    m_tablesUsedByAReport = m_tablesUsedByAReport & m_table.location & ";"
Next m_table

'table names in each of the subreports'
For Each m_section In m_rapport.Sections
    For Each m_objet In m_section.ReportObjects
        If m_objet.Kind = crSubreportObject Then
            Set m_subReport = m_objet
            Set m_report = m_subReport.OpenSubreport
            For Each m_table In m_rapport.Database.tables
                m_tablesUsedByAReport = m_tablesUsedByAReport & m_table.location & ";"
           Next m_table
        End If
    Next m_objet
Next m_section

'my tables list'
tablesUsedByAReport = m_tablesUsedByAReport

End function
Philippe Grondier
I modified the code, see my answer below
Nathan Koop
A: 

I had a similar issue with reporting services reports. I ended using a freeware app named Agent Ransack . I'm sure that there are lots of tools that do the same thing, but this is what I use. I just point it to a folder and put the table name I'm looking for in the "containing text field". I pull of my source from TFS into my VS projects folder and it doesn't take this app long to search all sub directories and it always seems to find what I need. It's not integrated into VS, but it may be worth a shot if no one provides a better solution.

Paul G
A: 

I modified Philippe's code to this:

Public Function tablesUsedByAReport(ByRef report As CrystalDecisions.CrystalReports.Engine.ReportClass) As String

    Dim m_tablesUsedByAReport As String = String.Empty

    Dim myTables As Tables = report.Database.Tables

    'table names in the report'
    For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
        m_tablesUsedByAReport = m_tablesUsedByAReport & myTable.Location & ";"
    Next
    For Each subreport As CrystalDecisions.CrystalReports.Engine.ReportDocument In report.Subreports
        For Each mytable As CrystalDecisions.CrystalReports.Engine.Table In subreport.Database.Tables
            m_tablesUsedByAReport = m_tablesUsedByAReport & mytable.Location & ";"
        Next
    Next
    Return m_tablesUsedByAReport

End Function
Nathan Koop