Welcome, Guest
Username: Password: Remember me

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

Array question with different values for the column, depending on answer option 10 months 3 days ago #103832

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2950
  • Thank you received: 377
  • Karma: 124
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:

cceb.png


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?
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Array question with different values for the column, depending on answer option 10 months 3 days ago #103837

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4360
  • Thank you received: 827
  • Karma: 381
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 10 months 3 days ago by tpartner.
The administrator has disabled public write access.

Array question with different values for the column, depending on answer option 10 months 3 days ago #103840

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4360
  • Thank you received: 827
  • Karma: 381
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.095 seconds
Donation Image