Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum find ducuments with "Coming In" or "Going Out" status
    • Sign In

    • State Verified Answer
    • Replies 11 replies
    • Subscribers 67 subscribers
    • Views 1454 views
    • Users 0 members are here
    • document
    • powershell
    • STATUS

    find ducuments with "Coming In" or "Going Out" status

    Ajomon George
    Offline Ajomon George over 1 year ago

    I was trying to search the documents with "Coming In" or "Going Out" status. But it is not working in Powershell.

    $Docs = Get-PWDocumentsBySearch -GetAttributes -FolderPath ".Transmission Pipelines\Bentpath East Pool NPS16\2020 ILI\" -Attributes @{Status = 'Coming In'} -GetVersionsToo -Verbose

    This script is not returning the result.

    • Sign in to reply
    • Cancel

    Top Replies

    • Chris Spencer
      Offline Chris Spencer Tue, Feb 1 2022 9:23 AM in reply to Ajomon George +1 verified
      If you want speed across a whole datasource try this way: #Query PW DB for CI or GO records $SQLStr = "SELECT o_docguid FROM dms_doc WHERE o_dmsstatus = 'CI' or o_dmsstatus = 'GO'" $SQLReturned…
    • MWBSI
      MWBSI Fri, Mar 18 2022 9:36 AM in reply to Ajomon George +1 verified
      The document status definitions are: D document is being deleted CI document is being checked in (Coming iI) I document is checked in GO document is being checked out (Going Out) O document is…
    • Brian Flaherty
      Offline Brian Flaherty Mon, Sep 12 2022 1:38 PM in reply to Todd Lanphear +1
      You can use the CheckIn-PWDocumentsOrFree cmdlet to free the documents returned from you search. Something like the following should work. $SQLResults = Select-PWSQL -SQLStatement "SELECT o_docguid…
    • Chris Spencer
      0 Offline Chris Spencer Tue, Feb 1 2022 8:25 AM

      Hi,

      Try this

      $Docs = Get-PWDocumentsBySearch -GetAttributes -FolderPath  "Test\Folder1\" -FileName % | Where-Object {$_.Status -eq "CI"}

      Oh and add your -GetVersionsToo and whatever folder path...

      Cheers

      Chris Spencer

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Ajomon George
      0 Offline Ajomon George Tue, Feb 1 2022 9:01 AM in reply to Chris Spencer

      I ran it and looks like a bit slow to fetch the results. Additionally Could you please tell me what is the value i need to give to get the "Going Out" status?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Chris Spencer
      +1 Offline Chris Spencer Tue, Feb 1 2022 9:23 AM in reply to Ajomon George

      If you want speed across a whole datasource try this way:

              #Query PW DB for CI or GO records
              $SQLStr = "SELECT o_docguid FROM dms_doc WHERE o_dmsstatus = 'CI' or o_dmsstatus = 'GO'" 
              $SQLReturned = Select-PWSQL -SQLSelectStatement $SQLStr
              
              
              #Setup Data table for CI GO report
              $dt = $null
              $dt = New-Object System.Data.Datatable ("CI-GO Report")
              $dt.Columns.Add('DocName') | Out-Null
              $dt.Columns.Add('DocStatus') | Out-Null
              $dt.Columns.Add('DocVersion') | Out-Null
              $dt.Columns.Add('DocumentURN') | Out-Null
      
              write-host Returned $SQLReturned.Rows.Count Rows
              
              foreach ($Item in $SQLReturned){
                  $DocGUID = $Item.o_docguid
                  
                  $FileDetail = Get-PWDocumentsByGUIDs -DocumentGUIDs $DocGUID
                  
                  $DocURN = $FileDetail.DocumentURN
                  $DocStatus = $FileDetail.Status
                  $DocName = $FileDetail.Name
                  $DocVersion = $FileDetail.Version
                  
                  $dr = $dt.NewRow()
                  $dr.DocumentURN = $DocURN
                  $dr.DocStatus = $DocStatus
                  $dr.DocName = $DocName
                  $dr.DocVersion = $DocVersion
                  $dt.Rows.Add($dr)
              }
             
             #Generate Excel Report
             $FileName = 'c:\temp\CI-GO Report.xlsx'
             New-XLSXWorkbook -InputTables $dt -OutputFileName $FileName -Open -Verbose

      Cheers

      Chris Spencer

      Answer Verified By: Ajomon George 

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Reject Answer
      • Cancel
    • Brian Flaherty
      0 Offline Brian Flaherty Thu, Feb 17 2022 11:02 AM in reply to Chris Spencer

      Could simplify slightly by using the following:

      $SQLStr = "SELECT o_docguid FROM dms_doc WHERE o_dmsstatus IN ('CI', 'GO')" 

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Ajomon George
      0 Offline Ajomon George Fri, Mar 18 2022 9:08 AM in reply to Brian Flaherty

      I have a different document status "Being Deleted". What is the status of that in the query?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    >

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies