#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

How To: Add a Column/Attribute To an Environment

Be sure to check out my Scripting4Crypto initiative. It’s a fun way to get into using cryptocurrencies all while getting your PowerShell needs met.

In this post, I want to quickly demonstrate how to add a document attribute to a ProjectWise Environment and set the Default Value and Value List options. We will only be using cmdlets available in the PWPS_DAB module.

Before doing so, I wanted to let you know, there are many cmdlets available with the PWPS_DAB module which can assist with the creation and administration of your ProjectWise Environments. The following is a list of those cmdlets available in the PWPS_DAB module, as of version I would recommend taking a look at the help for each command to become familiar with the available functionality.

  • Add-PWAttributeToInterface
  • Add-PWAttributeUpdateValueTriggerAttribute
  • Add-PWEnvironmentColumn
  • Get-PWAttributeUpdateValueTriggerAttribute
  • Get-PWAttributeValueListFixedList
  • Get-PWCustomNumericSetting
  • Get-PWCustomStringSetting
  • Get-PWEnvironmentColumns
  • Get-PWEnvironments
  • Get-PWInterfaceGUIDefinition
  • Get-PWInterfaces
  • New-PWEnvironment
  • New-PWInterface
  • Remove-PWAttributeUpdateValueTriggerAttribute
  • Remove-PWEnvironmentColumn
  • Set-PWAttributeDefaultValueSettings
  • Set-PWAttributeEditingSettings
  • Set-PWAttributeExtraValuesSettings
  • Set-PWAttributeGeneralSettings
  • Set-PWAttributeUpdateValueSettings
  • Set-PWAttributeValueListSettings
  • Set-PWCustomNumericSetting
  • Set-PWCustomStringSetting
  • Set-PWInterfaceGUILabel
  • Set-PWInterfaceGUILabelFont
  • Set-PWInterfaceGUIPrompt
  • Show-PWInterfaceGUIDefinition
  • Update-PWDocumentAttributes
  • Update-PWEnvironmentColumnName
  • Update-PWEnvironmentColumnWidth
  • Update-PWEnvironmentCopyData

Add New Attribute (Column) To ProjectWise Environment

First, lets create a couple of variables to store the ProjectWise Environment name to be used, and the column name for the new column to be added to the Environment.

# Environment to add the new attribute (column) to.
$PWEnvironmentName = 'MyTestEnv'
# New column name to be added to the Environment.
$ColumnName = 'Processed'

The following shows that column ‘Processed’ does not exist within my current ProjectWise Environment (‘MyTestEnv’).


Next, I am going to create a Splat to store the two parameter key value pairs to be used with each of the cmdlets.

# Parameter key value pairs to be used with each cmdlet.
$Splat = @{
    EnvironmentName = $PWEnvironmentName
    AttributeName = $ColumnName

Now, we will add the new attribute (column) to the ProjectWise Environment.

Keep in mind, we could have stored the -ColumnType and -ColumnWidth values within variables which would allow for us to easily switch types and widths.

# Add new attribute (column) the specified ProjectWise Environment
Add-PWEnvironmentColumn -EnvironmentName $PWEnvironmentName -ColumnName $ColumnName -ColumnType text -ColumnWidth 20 -Verbose



You will receive an error similar to below, if you had entered an incorrect Environment name.


You will receive an error similar to below, if the column name specified already exists  within the specified ProjectWise Environment.


Update Attribute Settings

Before we can update the attributes settings, we will to log out and log back in to our ProjectWise datasource. If you do not, you will receive an error message similar to below.



Now, we can update the attribute settings for the new attribute.

First, we will update the Default Value. We will set it to the fixed value of  ‘No’.

#Set the Default Value to a fixed value of 'No'.
Set-PWAttributeDefaultValueSettings @Splat -DefaultValueType Fixed -DefaultValueText 'No' -Verbose



Next, we will update the Value List settings. We will toggle on the Limit To List option and create a fixed list containing two values, ‘Yes’ and ‘No’.

# Set the Value List settings to toggle on the LimitToList option. 
# And create a Fixed list containing values 'Yes' and 'No.'
Set-PWAttributeValueListSettings @Splat -ValueType Fixed -LimitToList On -Value 'Yes' -Verbose
Set-PWAttributeValueListSettings @Splat -ValueType Fixed -Value 'No' -Verbose



View Attributes in ProjectWise Administrator

If you are already logged into the ProjectWise Administrator client, you may need to log out and back in to see the new ProjectWise Environment Attribute. Or at a minimum, do a refresh.

In the following, you  can see that the new attribute ‘Processed’ was created within the ‘MyTestEnv’ ProjectWise Environment.


Below you can see that the Default value was set to Type: Fixed, with a value of No. And the Value list was also set to Type: Filed, with values Yes and No. Also, the Limit To List option was toggled on.


Experiment with it and have fun.

Hopefully, you find this useful. Please let me know if you have any questions or comments.  If you like this post, please Like button at the bottom of the page.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.