Valuesets value label to Array

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Valuesets value label to Array

Post by htuser »

Dear Cspro Developper Team,
I would like to know if there's a way to dynamically transform valuesets values labels as an Array.
By example, for theses in a checkbox item, HA7_ENERGIES_UTILISEES_PR_CUISSP

Propa'n P/
Gaz blan G/
Chabon C/
Bwa B/
Kouran K/
Kouran PIC E/
Kouran leta D/
Lot L/
Pa gen repons DK
Kesyon sa pa ka aplike NA


could be: array string HA7_ENERGIES(10): "P/","G/","C/","B/","K/","E/","D/","L/",DK"","NA";

It will be used in a dynamic function able to getlabel for checkbox.

Code: Select all

function string multipleLabel (string questionMultipleDictionaryNamee, string arrayName)
string labelMultiple = "";

do ctr = 2 {size (arrayName)} while ctr <= 11{length(arrayName)}

    if (pos(arrayName(ctr),questionMultipleDictionaryName)) <> 0 then
         
        if length(labelMultiple) > 0 then
            labelMultiple = labelMultiple + " ";
        endif;
           
        labelMultiple = labelMultiple + getlabel(questionMultipleDictionaryName, arrayName(ctr));
    endif;
enddo;
multipleLabel=labelMultiple;
end; 
Thanks in advance,
G.VOLNY, a CSProuser from Haiti, since 2004
aaronw
Posts: 561
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: Valuesets value label to Array

Post by aaronw »

It's not possible to dynamically convert a value set's value label to an array. The getlabel function's 1st argument is a dictionary_symbol and it's not possible to specify this in a generic way.
Post Reply