Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UpdateItemProperties: Changed behaviour in Vault 2015?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
KarlR.J.Wehr
871 Views, 7 Replies

UpdateItemProperties: Changed behaviour in Vault 2015?

I'm using the the UpdateItemProperties method to change one specific item property for an array of items. I use it this way:

UpdateItemProperties(itemRevIds, PropertyDefIds, Values)

itemRevIds is an array of items, PropertyDefIds is an array with length 1 with the id of a specific propertyDef, that has to be edited, Values is an array with length 1 with the value to be set.

In R2014 this worked fine, but in R2015 I get an Error 137 (IllegalInputParam), if there is more than one item in the item array.

Is there a change in behaviour in R2015?

7 REPLIES 7
Message 2 of 8
minkd
in reply to: KarlR.J.Wehr

The length of the 3 arrays you are passing should be the same.

 

If you want to set the same property value for 20 items, you will need to repeat the property definition and value 20 times.

 

-Dave



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
Message 3 of 8
minkd
in reply to: minkd

Actually, the UpdateItemProperties method doesn't appear to follow the normal "synchronized" array convention that many other methods use.

 

I'll have to get back to you on this one.

 

-Dave



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
Message 4 of 8
minkd
in reply to: minkd

In 2015 to change a single property to the same value of X items, you will need to call UpdateItemProperties X times. This is the result of an unintended side-effect of a change intended to make the Update Property calls more consistent across different entity classes. We will correct this behavior and document it better in a future release.

 

Another change to the UpdateItemProperties in 2015 that we missed in the documentation is that the items are no longer committed during the call. Instead we now return the items so that clients can decide to cancel or commit the change. Therefore, you should build up an array of uncommitted items from your calls to UpdateItemProperties and then call UpdateAndCommitItems at the end.

 

-Dave

 



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
Message 5 of 8
KarlR.J.Wehr
in reply to: KarlR.J.Wehr

Hi Dave,

 

many thanks for your detailed answer!

 

Kind Regards

Karl

Message 6 of 8
KarlR.J.Wehr
in reply to: KarlR.J.Wehr

can you please confirm, that -- for a single item -- it is not possible to change more than one property at a time, too?

It tried to pass in an array of properties and came along error 137. Going through a loop and setting each property with a single call worked.

 

So I have to call the UpdateItemProperties function for each item and each property leading to 100 calls for 10 items with 10 properties?

Message 7 of 8
minkd
in reply to: KarlR.J.Wehr

In 2015, you can update multiple properties for an item with one call, but you will have to repeat the itemID for each one of them.

 

-Dave



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
Message 8 of 8
KarlR.J.Wehr
in reply to: minkd

Again, thanks for your answer!

So, you have to fill in arrays of items, propertyDef-Ids and Values, each with the same size. This way, the call works!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report