# Array question with different values for the column, depending on answer option

4 years 8 months ago #103832 by holch
holch created the topic: Array question with different values for the column, depending on answer option
Here in Brazil the SEC (socio-economic class) of a respondent is calculated based on the number of certain goods that they have in their house hold and the level of education of the head of household (I don't think that it works very well, but I don't want to start a discussion about this.... ).

Now I would like to be able to calculate the SEC already during the survey, because then I could set quota based on the SEC as well.

So what we do is to ask the number of color TVs, radios, bathrooms, cars, maids, washing machines, video recorders/DVD players, fridge and freezer. The scale is 0,1,2,3,4+. However, unfortunately some items get more points than others. So while for one TV set in your household you get 1 point, for the first bath room you'll get 4 points (for the following only one...).

Here an example of the table:

So the first thing I would need is to calculate a total count based on the points in this table. I am not sure if Expression Manager can do this (I didn't find an example) and I think assessments only allow to give the same assessment value per column.

The next step would be to add the points from the education level (this is simpler because it is a single choice question to this total. Based on this total count the SEC is determined.

Any hint on how to start this?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
##### Attachments:

4 years 8 months ago - 4 years 8 months ago #103837 by tpartner
tpartner replied the topic: Array question with different values for the column, depending on answer option
Hi holch.

I see a couple of ways to tackle this...

1) Use a normal array type question and then have JavaScript add "data" attributes containing the "score" to each radio. When the question is answered, the script could add all of the clicked radio scores and load the results in a hidden text question.

2) Create separate list-radio questions for each item. The answer codes for these list-radio questions would be the "scores". JavaScript could then be used to place all of these questions into an array format.

I think I would prefer method 2. Although it would probably require a little more scripting, it would allow you to use Expression Manager more freely with the results and even apply quotas directly to the "array" (for example if your survey is about TVs and they say they have none, toss them out).

Let me know if either suits and I'll put together a little example for you.

.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 4 years 8 months ago by tpartner.

4 years 8 months ago #103840 by tpartner
tpartner replied the topic: Array question with different values for the column, depending on answer option
Oh, wait, in #2, we can't use the answer codes as "scores" because there would be duplicates in some questions. We would need to use assessment values as the scores. Everything else would be as described above.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.