Page 1 of 1

Name Generation

Posted: October 8th, 2023, 1:47 am
by Romij Chowdhury
When i enter a name on this empty box in the picture.....

Re: Name Generation

Posted: October 8th, 2023, 1:50 am
by Romij Chowdhury
Name will be generated automatically in the option list........what will be the logic of this please can anyone tell me ?

Re: Name Generation

Posted: October 8th, 2023, 2:47 pm
by justinlakier
This logic is Dynamic Valuesets. In the preproc of the options list, you can add something like this code, found in the help documentation for the ValueSet Object. Rather than creating a new ValueSet object, you can also refer to an existing value set for the options list in your dictionary. Using valueset.add and setvalueset, you can change the options to include data based on the contents of NAME. In this example it is assumed that NAME is multiply occurring in a PERSON_REC record we can loop through to get all names.
PROC RESPONDENT
preproc

    ValueSet
respondent_valueset;

    do numeric counter = 1 while counter <= count(PERSON_REC)
            [/color]respondent_valueset.add(NAME(counter), counter);
    enddo;

    setvalueset(RESPONDENT, respondent_valueset);
Hope this helps,
Justin La Kier

Re: Name Generation

Posted: October 9th, 2023, 2:01 am
by Romij Chowdhury
can you do this with my Zip file i cant get it, please make the logic correct for me on "Module A1" name will be entered in "GU_A1_A2" section and option will be generated in "GU_A1_A6c" .....advance thank you!!

Re: Name Generation

Posted: October 9th, 2023, 3:43 am
by Romij Chowdhury
What is the solution of it?
My Cspro version is 7.7.3

Re: Name Generation

Posted: October 9th, 2023, 11:56 am
by Arjun Brti
Valueset is used for numeric variable. Your var is string so you should used "Valueset string Respondent_valueset".

Re: Name Generation

Posted: October 10th, 2023, 1:44 am
by Romij Chowdhury
i cant make a solution.......can anyone please do for me with my zip file which is already uploaded earlier?

Re: Name Generation

Posted: October 10th, 2023, 4:21 am
by Arjun Brti
Try by changing your var from string to numeric.