How to create dynamic valueset for Multiple

Discussions about CSEntry
Post Reply
naylinnsoe
Posts: 31
Joined: June 22nd, 2012, 7:14 am
Location: Yangon

How to create dynamic valueset for Multiple

Post by naylinnsoe »

I want to write codes for dynamic valueset for Multiple .
e.g I want to ask
Q1. Which brands do you Know? (MA)
Brand A (Yes)
Brand B (Yes)
Brand C
Brand D (Yes)
Brand E (Yes)
Brand F
Brand G
Brand H (Yes)
and then next question. select from Q1.
Q2. Which brands do you drink? (Multiple Answer) (not Single answer)
Brand A
Brand B
Brand D
Brand E
Brand H
Select from above brands only and I don't want to show other brands that are not know.

How Can I Write code for dynamic valueset for Multiple .
Gregory Martin
Posts: 1801
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: How to create dynamic valueset for Multiple

Post by Gregory Martin »

Look at how the LANGUAGES_SPOKEN and MAIN_LANGUAGE fields were handled in the Simple CAPI example, available here:

C:\Program Files (x86)\CSPro 6.0\Examples\1 - Data Entry\Simple CAPI
PROC MAIN_LANGUAGE

onfocus

    
// set up the value set using languages that the person speaks; if only one, preselect the language
    vsItr = 1;
    
    
do ctr = 1 while ctr <= length(LANGUAGES_SPOKEN)
    
        
string thisOption = LANGUAGES_SPOKEN[ctr:1];

        
if thisOption <> " " then
        
            vsCodes(vsItr) =
pos(thisOption,alphabet);
        
            
if thisOption = "1" then // the other field
                vsLabels(vsItr) = LANGUAGES_SPOKEN_OTHER;
            
            
else
                vsLabels(vsItr) =
getlabel(LANGUAGES_SPOKEN,thisOption);
            
            
endif;  
        
            
inc(vsItr);
            
        
endif;

    
enddo;

    vsCodes(vsItr) =
notappl; // end the dynamic value set

    
setvalueset(MAIN_LANGUAGE,vsCodes,vsLabels);

    
setcapturetype(MAIN_LANGUAGE,3); // display the value set as a drop down
naylinnsoe
Posts: 31
Joined: June 22nd, 2012, 7:14 am
Location: Yangon

Re: How to create dynamic valueset for Multiple

Post by naylinnsoe »

Dear Gregory Martin,

Thank you for explanation.
But your example is creating dynamic valueset for Single Answer based on Multiple answer.

BUT my question is HOW to create dynamic valueset for MULTIPLE answer based on another MULTIPLE answer.
Myanmar
htuser
Posts: 632
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: How to create dynamic valueset for Multiple

Post by htuser »

Dear Gregory and Nalynnsoe,
I would like to solve the same problem, but in a roster.
I've an application with several form(page) where the family member roster field(members NAME and AGE) are repeated in several form(page): Education, labour force, migration, opinions, health, revenues, expense etc.
It's because i write an easy code to copy automatically copy PERSON_NUMBER , NAME, AGE and of each person on each roster's form in each page.

But, until now i can't copy automatically the AGE without using a multiples temporary numeric variable to store AGE for each persons from the first roster.
The problem with this approach for copying AGE is, if the surveyor modify another household form, the temporary variable store another AGE value for different household members... However, since some criterias are based on AGE of household members, it's very important and time consuming the write AGE manually on each roster. It's because i would like to use better approach.

The other problem, is, by example, in the expense roster, we should collect data for multiple expense type for each persons... It's because i would like to have a dynamic value set single choice who can display all household members NAME. The SHOW function should be perfect to do this if it allowed to copy the string from his windows to field. It's because, we would like to receive some helps.
Thanks in advance,
G.VOLNY, a CSProuser from Haiti, since 2004
vastonsmith
Posts: 1
Joined: May 4th, 2015, 5:32 am

Re: How to create dynamic valueset for Multiple

Post by vastonsmith »

Hi Everyone,

How to create folder during runtime in Android? usually I run external command to do this, but I don't know what command to run in Android.

Thanks in advance,

-iip-
Post Reply