Page 1 of 1

CAPI Question text from Multiple response

Posted: October 29th, 2015, 6:16 am
by vipul315singhal
Hi,
I want to take the value/text(say it is on 4th position) of a muliple response variable into the CAPI window of single response.
For single response we just took %variable name%, what if we have to take variable name of a specific position form multiple response question?

Thanks in advance!

Regards
Vipul

Re: CAPI Question text from Multiple response

Posted: October 29th, 2015, 1:46 pm
by josh
You can declare a global logic variable that you use in the question text and assign the value of that variable from the value set using the function getlabel(). For example:

Code: Select all

PROC GLOBAL

string mycapistring;

PROC MYSINGLERESPONSE
onfocus

// Get label from the value set of the multiple response MYMULTIRESPONSE that has the value "D".
mycapistring = getlabel(MYMULTIRESPONSE, "D");
In the question text insert %mycapistring%.

Re: CAPI Question text from Multiple response

Posted: October 30th, 2015, 7:16 am
by vipul315singhal
Hi Josh,
I tried to do so but it is not showing the response captured in the string. Can you please have a look in the attached demo file. If any correction required please let me know.

Thanks & Regards
josh wrote:You can declare a global logic variable that you use in the question text and assign the value of that variable from the value set using the function getlabel(). For example:

Code: Select all

PROC GLOBAL

string mycapistring;

PROC MYSINGLERESPONSE
onfocus

// Get label from the value set of the multiple response MYMULTIRESPONSE that has the value "D".
mycapistring = getlabel(MYMULTIRESPONSE, "D");
In the question text insert %mycapistring%.

Re: CAPI Question text from Multiple response

Posted: October 30th, 2015, 2:51 pm
by noel
Excuse me, I am not Josh but I think I can help.

In your example you have the following logic:

PROC Q101_NAME
onfocus
abc = getlabel(Q101_NAME,"2");

This means that you want to assign the label of Q101_NAME to abc for value 2. As Q101_Name does not have any valueset this logic will assign a Blank value to abc. This is why nothing is shown in the CAPI screen. So add a valueset to Q101_Name and you will have a value label for "2" displayed in the CAPI screen.

I don't understand what you really ant to do. Do you want to display the information captured in Q101_NAME000 section in the CAPI screen or something else?

Re: CAPI Question text from Multiple response

Posted: November 2nd, 2015, 3:21 am
by vipul315singhal
Hi Noel,

Thanks for the explanation. Yes, i want to display the information captured in Multiple response question somewhere else in CAPI Screen only. Is there any way to do that?

Regard
Vipul

Re: CAPI Question text from Multiple response

Posted: November 2nd, 2015, 7:09 am
by josh
I think what is confusing is the term "muliple response". That generally refers to items where you have set a of fixed responses from which can you pick more than one and is done with a set of checkboxes. That is what Noel and I assumed you were trying to do and for that you need an alpha item with a vaue set.

What you have in your application is not a checkbox item but a repeating alpha item (aka a roster). To get the value of an a repeating item you need to use a subscript. You do this by putting a number in parentheses after the name of the variable. For example Q101_NAME(1) would get the value in the first row of the roster, Q101_NAME(2) would ge the value in the second row... So if you want to modify your application to display the value from the second row in the question text you could simply change the existing to logic to:

onfocus
abc = Q101_NAME(2);

Re: CAPI Question text from Multiple response

Posted: November 3rd, 2015, 2:51 am
by vipul315singhal
Hi Josh,

Yes it is working.
Thanks Josh & Noel for your support. :)

Regards
Vipul