Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Help with Get-DocumentReportDataTable
    • Sign In

    • State Verified Answer
    • Replies 10 replies
    • Subscribers 65 subscribers
    • Views 2811 views
    • Users 0 members are here
    • powershell
    • Export

    Help with Get-DocumentReportDataTable

    Andrew Pettus
    Offline Andrew Pettus over 5 years ago

    I am trying to create a drawing index in Projectwise using Powershell.  I used the get-documentreportdatatable cmdlt and it worked fine but I would like to pick and choose the attributes that powershell exports to excel because it gives me a lot of superfluous information well all I really need is the drawing #, title state, rev, and who the document was checked out to.  Is their anyway I can control what info this cmdlt sends to excel or should I try a different cmdlt?

    • Sign in to reply
    • Cancel

    Top Replies

    • Brian Flaherty
      Offline Brian Flaherty Thu, Jul 12 2018 4:09 PM +2 verified
      You could try Get-PWDocumentsBySearch with the -GetAttributes switch parameter included. Then loop through the results populating a datatable with only the info you would like to capture. Finally, output…
    • Nathan Banks
      0 Offline Nathan Banks Sat, Jun 30 2018 4:24 AM

      Would piping to a Select-Object help before exporting to excel? Something like:

      get-pwdocumentreportdatatable | Select-Object drawing #, title state, rev, @{Name="Checked Out By"; Expression = {$_.checkedoutby}} | Export-Excel

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Andrew Pettus
      0 Offline Andrew Pettus Mon, Jul 2 2018 10:17 AM in reply to Nathan Banks

      No luck with this, thanks for the help though.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Thu, Jul 5 2018 11:02 AM in reply to Andrew Pettus

      The datatable object is a .NET object that is more like a SQL database table than regular powershell objects (and significantly faster for large data sets). There isn't anything "projectwise-y" about it so you can use normal DataTable operations on the result.

      Search on PowerShell DataTable for some info on working with it. I didn't spot an official tutorial or anything on it, but lots of basic info around.

      I think to drop a column  you don't need from the table you can do:

      $table.Columns[X].Dispose()

      where X is the column number (zero-indexed) to get rid of.  I didn't have time to try this out myself to make sure. but hopefully this gives you a starting point.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Andrew Pettus
      0 Offline Andrew Pettus Tue, Jul 10 2018 4:06 PM in reply to Kevin van Haaren

      Columns[X].Dispose() does nothing for me and most of the sources I found online tell me to use Columns[X].Delete() but this doesn't work either.  Both either show no error but don't delete the column or they give me an error stating "Method invocation failed because [System.Data.DataColumn] does not contain a method named 'Dispose' (or 'Delete').

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Wed, Jul 11 2018 10:12 AM in reply to Andrew Pettus

      what do you get back if you do Columns[X] | get-member?

      that should list all the properties and methods you can use on that column.

       

      • 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