Passing an attribute from a work area to an environment

I would like to pass the value in a work area to an environment. It seems like this is something I should be able to do but am having some difficulty. Basically I want to take a job number from the work area and populate that value in the environment. Can anyone help me with this?

Some of my confusion revolves around the documentation and syntax. When I am looking at the SQL statements sometimes a SELECT command is included but when reading the help it is not can someone point me in the right direction here also?

Thanks in advance, 

Josh

Parents
  • ,

    As I like to say "words get in the way".

    I get hung up on language such as "pass a value to an environment".

    Assuming that you want a document attribute to contain the value for a Project Property, you can do that by configuring the PW Environment via the PW Administrator client.  A certified PW Administrator would know how to do it.

    Since you are asking in the Programming forum, I'll assume that you want to do it via code.

    You would first need to get the value, and that's a bit complicated, but if you are using C# and MostOfDavesClasses.cs, then Dave provides helpful methods for determining classIds, and other information that you will need to eventually get the value for a Project Property.  Once you have the value, then you can use some of Dave's methods for updating document attributes.

    Getting the Project Property value is non-intuitive, but doable if you work through the information provided by the PW SDK help under the module named "ProjectWise ODS API".

    To update a document attribute, it needs to exist, so you will need to create the document attributes if they don't exist.  That's a three step process. And if you want to update an existing document sheet (row in the environment table), that too is a three step process.  Take a look at the information in the PW SDK help under the module named "ProjectWise DMS API" -> "Link Data Functions".

    This post may be of help:  https://communities.bentley.com/products/programming/projectwise_programming/f/projectwise-programming---forum/108051/attribute-sheets-how-do-you-tell-if-they-are-missing-and-how-do-you-add-one/327864#327864 

    Avoid making changes via SQL as you can easily corrupt the PW database.  However, if you simply want to UPDATE an existing row in a table that is a PW Environment, that is OK as long as you only update "user attributes", i.e. just the columns that are intended for "user data", and never update any of the columns created and maintained by PW.  You should also understand that if you update the database directly, "ProjectWise" doesn't know that you did nor care, so if the change needs to be "seen" by any clients, PW Explorer, web, or your own custom clients, you will need to force the client to get the related data from the datasource.  For PW Explorer, you can typically do this with a call to aaApi_UpdateDocumentWindows().  Avoid updating environment rows via sql for interactive customizations as using appropriate API functions will provide you with "better" functionality".  Using SQL bulk updates is acceptable for such tasks as nightly "updates" from other data systems while few users are signed up.  That way, the related data caches on the server and clients will have time to "sync" with the changes to the databse.

    This post may also be of help:

    https://communities.bentley.com/products/programming/projectwise_programming/f/projectwise-programming---forum/112335/random-error-when-updating-attributes/343100#343100 

    HTHs

Reply
  • ,

    As I like to say "words get in the way".

    I get hung up on language such as "pass a value to an environment".

    Assuming that you want a document attribute to contain the value for a Project Property, you can do that by configuring the PW Environment via the PW Administrator client.  A certified PW Administrator would know how to do it.

    Since you are asking in the Programming forum, I'll assume that you want to do it via code.

    You would first need to get the value, and that's a bit complicated, but if you are using C# and MostOfDavesClasses.cs, then Dave provides helpful methods for determining classIds, and other information that you will need to eventually get the value for a Project Property.  Once you have the value, then you can use some of Dave's methods for updating document attributes.

    Getting the Project Property value is non-intuitive, but doable if you work through the information provided by the PW SDK help under the module named "ProjectWise ODS API".

    To update a document attribute, it needs to exist, so you will need to create the document attributes if they don't exist.  That's a three step process. And if you want to update an existing document sheet (row in the environment table), that too is a three step process.  Take a look at the information in the PW SDK help under the module named "ProjectWise DMS API" -> "Link Data Functions".

    This post may be of help:  https://communities.bentley.com/products/programming/projectwise_programming/f/projectwise-programming---forum/108051/attribute-sheets-how-do-you-tell-if-they-are-missing-and-how-do-you-add-one/327864#327864 

    Avoid making changes via SQL as you can easily corrupt the PW database.  However, if you simply want to UPDATE an existing row in a table that is a PW Environment, that is OK as long as you only update "user attributes", i.e. just the columns that are intended for "user data", and never update any of the columns created and maintained by PW.  You should also understand that if you update the database directly, "ProjectWise" doesn't know that you did nor care, so if the change needs to be "seen" by any clients, PW Explorer, web, or your own custom clients, you will need to force the client to get the related data from the datasource.  For PW Explorer, you can typically do this with a call to aaApi_UpdateDocumentWindows().  Avoid updating environment rows via sql for interactive customizations as using appropriate API functions will provide you with "better" functionality".  Using SQL bulk updates is acceptable for such tasks as nightly "updates" from other data systems while few users are signed up.  That way, the related data caches on the server and clients will have time to "sync" with the changes to the databse.

    This post may also be of help:

    https://communities.bentley.com/products/programming/projectwise_programming/f/projectwise-programming---forum/112335/random-error-when-updating-attributes/343100#343100 

    HTHs

Children
No Data