CAPI Question text from Multiple response

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
vipul315singhal
Posts: 25
Joined: March 28th, 2013, 9:17 am

CAPI Question text from Multiple response

Post 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
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: CAPI Question text from Multiple response

Post 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%.
vipul315singhal
Posts: 25
Joined: March 28th, 2013, 9:17 am

Re: CAPI Question text from Multiple response

Post 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%.
Attachments
Demo.zip
(4.13 KiB) Downloaded 454 times
noel
Posts: 25
Joined: June 16th, 2012, 7:32 pm
Location: Libreville, Gabon

Re: CAPI Question text from Multiple response

Post 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?
vipul315singhal
Posts: 25
Joined: March 28th, 2013, 9:17 am

Re: CAPI Question text from Multiple response

Post 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
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: CAPI Question text from Multiple response

Post 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);
vipul315singhal
Posts: 25
Joined: March 28th, 2013, 9:17 am

Re: CAPI Question text from Multiple response

Post by vipul315singhal »

Hi Josh,

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

Regards
Vipul
Post Reply