Enumerating valuesets of an item in code

Other discussions about CSPro
Forum rules
New release: CSPro 8.0
Post Reply
alex_izm
Posts: 19
Joined: December 9th, 2016, 11:31 am

Enumerating valuesets of an item in code

Post by alex_izm »

Hello everyone!

I was wondering in CSPro code is it possible to get a reference to a valueset(s) object of a dictionary item. Say for example I have a dictionary item WCOL1, which has a value set WCOL1_VS1. In code I can get a reference to the value set object by declaring a variable of type ValueSet and just assigning it from WCOL1_VS1 like this:

Code: Select all

ValueSet myVs = WCOL1_VS1;
But what if I don't know the name of the value set at compilation time, and only know the item name? Firstly I need to know how many value sets the item contains (if any), and then assign first (or second, or third) value set to 'myVs' object. Something like:

Code: Select all

ValueSet myVs;
numeric vsCount = WCOL1.GetValueSetCount(); //get count of value sets defined in WCOL1 dictionary item
if vsCount then
  myVs = WCOL1.GetValueSet(1); //assigning the first valueset of WCOL to 'myVs'
endif;
Is something like this possible? If not, is there maybe some kind of clever workaround?

Thanks!
Alex
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Enumerating valuesets of an item in code

Post by josh »

No, there isn't any way to enumerate all the value sets of an item.
Post Reply