Increase Document version value


could anybody be so kind and could help me with this little issue? I need to write a little script which should increase the number of document version by one. But I am getting error: Obejct required: [string: "1"]  for row: Dim oVersion: Set oVersion = PropertyValues.SearchForProperty( iPDVersion ).TypedValue.DisplayValue

What am I doing wrong here? 

My code:

Dim iPDVersion: iPDVersion = Vault.PropertyDefOperations.GetPropertyDefIDByAlias("PD.Version")
Dim oVersion: Set oVersion = PropertyValues.SearchForProperty( iPDVersion ).TypedValue.DisplayValue

Dim oPropValNew: Set oPropValNew = CreateObject("MFilesAPI.PropertyValue")
Dim oPropValsNew: Set oPropValsNew = CreateObject("MFilesAPI.PropertyValues")

oPropValNew.PropertyDef = iPDVersion
oPropValNew.TypedValue.SetValue, oVersion + 1

oPropValsNew.Add -1, oPropValNew

Thank you! 

Top Replies

Parents Reply
  • Hi Ne0Tr0n. 

    Ok, I see! So it means that this row is also wrong: oPropValNew.TypedValue.SetValue, oVersion + 1

    What should I use here? .TypedValue.DisplayValue doesn´t work neither. The type for Version is number (integer) and the number is generated by automatic values. 

    Thanks a lot for your help!