Community
Vault Forum
Welcome to Autodesk’s Vault Forums. Share your knowledge, ask questions, and explore popular Vault topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get distinct values for a property?

5 REPLIES 5
Reply
Message 1 of 6
ngarone
522 Views, 5 Replies

How to get distinct values for a property?

Hi all,

 

    I need to list all distinct values stored in an Item property, in the same way one do in SQL with SELECT DISTINCT myfield FROM mytable

I know I could get all items with 

 

itmSvc.GetAllLatestItems()

and then cycle trough the array and using 

 

itmSvc.GetItemProperties(New Long() {itm.Id}, New Long() {MyPropDefId})

get the value of the property and finally collecting all the values, taking each value only one time, but I'm wondering, isn't there a better way?

 

Thanks

Nicola

 

5 REPLIES 5
Message 2 of 6
ngarone
in reply to: ngarone

Well

I optimized my code building an array with all my item ids, and calling itmSvc.GetItemProperties only one time.

Now it runs really faster, but I think there should be an API to do this, simply I didn't find it.

Thanks

Nicola

Message 3 of 6
Pingyong.Zhang
in reply to: ngarone

Thanks for your post! 

 

Your second way is rigth. There is not a API to get distinct values for a property.

Message 4 of 6
Redmond.D
in reply to: Pingyong.Zhang

For properties where the user can input any value, there is no way to get distinct values.

 

However, if the property requires the user to select from a list, you can get that list using GetPropertyDefinitionInfosByEntityClassId in the PropertyService.  I'm not sure if that helps or not.



Doug Redmond
Software Engineer
Autodesk, Inc.

Message 5 of 6
paola.cacciotti
in reply to: Redmond.D

Sorry if i resume this old post, but i need a method to retrieve che distinct value of a file property. In particular i need to know all distinct file extensions stored in Vault.

 

I have Vault SDK 2013 API.

Message 6 of 6
minkd
in reply to: paola.cacciotti

Sorry, but no such API exists.

 

-Dave



Dave Mink
Fusion Lifecycle
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report