Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

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

  • holch
  • holch's Avatar Topic Author
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 10 months ago #103832 by holch
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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 10 months ago - 10 years 10 months ago #103837 by tpartner
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: 10 years 10 months ago by tpartner.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 10 months ago #103840 by tpartner
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.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose