Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum SQL Script and convert it to a powershell function within Projectwise.
    • Sign In

    • State Verified Answer
    • Replies 4 replies
    • Subscribers 65 subscribers
    • Views 1481 views
    • Users 0 members are here
    • attribute
    • powershell
    • ProjectWise PowerShell Modules

    SQL Script and convert it to a powershell function within Projectwise.

    Adam Guerrieri
    Offline Adam Guerrieri over 5 years ago

    UPDATE I_STATION_NUMBER__NAME SET PROJECT_Station_ID = (SELECT LEFT(o_projectname, CASE WHEN charindex(' ', o_projectname) = 0 THEN LEN(o_projectname) ELSE charindex(' ', o_projectname) - 1 END))

    from dms_proj

    INNER JOIN

    I_STATION_NUMBER__NAME

    ON dbo.dms_proj.o_instanceid = dbo.I_STATION_NUMBER__NAME.PROJECTTYPEID

    Where o_envno = 101

    AND o_parentno IN ('5609','5611','5613','5614','5616','5617','5618','5619','103620');

     

    This is to update the station number attribute from the Project Name.  Is there a way to accomplish this with a powershell script?

    • Sign in to reply
    • Cancel

    Top Replies

    • Brian Flaherty
      Offline Brian Flaherty Tue, Nov 14 2017 3:21 PM in reply to Adam Guerrieri +1 verified
      The following should get you started. # Populate variable with all rich project objects # Use the -FolderPath or -FolderName parameters to filter the projects returned. $projects = Get-PWRichProjects…
    • Brian Flaherty
      0 Offline Brian Flaherty Mon, Nov 13 2017 3:53 PM

      Take a look at the Update-PWDocumentAttributes cmdlet.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Adam Guerrieri
      0 Offline Adam Guerrieri Tue, Nov 14 2017 8:32 AM in reply to Brian Flaherty

      I agree that will work to push the new attribute, but how do I get the project name?  We are using Projectwise SS4

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Brian Flaherty
      +1 Offline Brian Flaherty Tue, Nov 14 2017 3:21 PM in reply to Adam Guerrieri

      The following should get you started.

      # Populate variable with all rich project objects
      # Use the -FolderPath or -FolderName parameters to filter the projects returned.
      $projects = Get-PWRichProjects

      # Loop thru each project and get the project name.

      foreach($project in $projects) {


      $properties = $project.ProjectProperties

      $ProjectName = $project.ProjectProperties.PROJECT_Project_Name
      $ProjectName

      #Update-PWDocumentAttributes


      }

      Answer Verified By: Adam Guerrieri 

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Reject Answer
      • Cancel
    • Adam Guerrieri
      0 Offline Adam Guerrieri Wed, Jan 3 2018 8:43 AM in reply to Brian Flaherty

      Brian thanks for your help, I was able to complete the script and have it running in production now.

      • 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