Script for Crystal Report Fields

This topic contains 1 reply, has 2 voices, and was last updated by  postanote 3 months, 1 week ago.

  • Author
    Posts
  • #98643

    Josephine8888
    Participant

    I have started a new job and been asked to clean up approximately 300 crystal reports. Ideally I would be able to source the name and fields used in each report without opening then individually.

    I found some code and it seems that it's executing, but not recording the output anywhere. I'm very new to PowerShell so struggling a bit!

    Get-ChildItem 'S:\Reports\SITE' *.rpt -Recurse  | % {
    
        $_.Database.Tables | Select-Object location -Expand location
        $_.Subreports | % { $_.Database.Tables | Select-Object location -Expand location }
    
    } | Select-Object location -Unique | Sort-Object Location
    
  • #98646

    postanote
    Participant

    You don't show what is in this...

    Get-ChildItem 'S:\Reports\SITE' *.rpt
    

    So, you need to step through you code one segment at a time to make sure you are getting something to work with.

    Secondly. doing this sort of thing...

        
    $_.Database.Tables | Select-Object location -Expand location
    $_.Subreports | % { $_.Database.Tables | Select-Object location -Expand location
    

    ... is really not a thing. In order to use dot notation, the thing you are looking at must be a object that has such properties.

You must be logged in to reply to this topic.