Support Forums : Write hidden values into matrix question (script on sku/loop)

We encourage an open exchange of information. Ask your questions or make suggestions. We are here to help, but we also encourage all of you to help one another.
Click on the Subscribe Flag to be notified by email of replies to your post.
Current User: Guest Login Register
Please consider registering

Write hidden values into matrix question (script on sku/loop)

Add a New Topic Reply to Post
UserPost

1:18
June 10, 2008


scott

Member

sydney

posts 11

Hi,

I am trying to set up a hidden matrix question with 7 columns and 4 rows. The 7 columns can simply be 1 to 7, and the four rows are options 1 to 4.
So the script I am trying to develop, will write 4 hidden values matching each of the options 1 to 4, which will appear as ticked in each row in the matrix questions.

The skus for the 4 options are 201, 202, 203 and 204. The 4 values I want to write to each one is 2, 3, 7, and 5. I started with

%%skus[]=201;
%%skus[]=202;
%%skus[]=203;
%%skus[]=204;

and I know the loop part starts with

foreach (%%skus as %%sku){

I guess I need to use SgapiSetValue, but I don’t know how you refer to each sku in SpagiSetValue within loop. So I don’t know exactly what I should write into the loop part so the value for each sku will be 201 is 2, 202 is 3, 203 is 7 and 204 is 5.

Could you please provide some advice on this? This is for a question that is not asked in the survey, but will need to be exported as a part of data for analysis. Moreover, different versions (branches) of surveys will have 4 different numbers for 201 to 204, that part I can deal with using if condition in script to control (just create multiple loops based on version).

Sorry I could not find anything in the forum for this neither I can find any documentation relating to this level of scripting on sku. I will be really appreciated if you can help.

Thanks

Scott

1:43
June 11, 2008


Chad

Moderator

posts 739

Hi Scott,
If you’re just trying to bring in the values from the table rows, you can use the row merge code in the default value for the hidden question.

If you need to do this in a script I would skip the loop and just code in each row individually.

Assume hidden question skus were (1,2,3,4)

sgapiSetValue(1,sgapiGetValue(201));
sgapiSetValue(2,sgapiGetValue(202));
sgapiSetValue(3,sgapiGetValue(203));
sgapiSetValue(4,sgapiGetValue(204));

Hope this helps,
Chad

8:07
June 11, 2008


scott

Member

sydney

posts 11

Hi Chad,

Thanks very much for your help, this is exactly what I want to do.

Scott

Add a New Topic Reply to Post


Reply to Topic: Write hidden values into matrix question (script on sku/loop)

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 11 + 12        (Required)

Topic Reply:


 
© Simple:Press Forum - Version 3.1.4 (Build 357)