Page 1 of 1

Valuesets value label to Array

Posted: November 8th, 2018, 12:29 pm
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,

Re: Valuesets value label to Array

Posted: November 9th, 2018, 8:56 am
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.