Welcome to the LimeSurvey Community Forum

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

How to change response code depending subquestion in an Array

  • Episteme Investigación e Intervención Social
  • Episteme Investigación e Intervención Social's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 23 hours ago - 1 year 23 hours ago #242803 by Episteme Investigación e Intervención Social
How to change response code depending subquestion in an Array was created by Episteme Investigación e Intervención Social
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi,
I am building a psychological scale in which each answer counts X points depending the subquestion. For example, in subquestion Y001, X001 counts 1 point so I code it with the number 1. Instead, in subquestion Y002, response X001 counts 5 points, so I would like to code it with the number 5. This way, when I download the code responses I just have to sum all the points and I don't have to look to each scale to see which response counts different. I saw there's the option called equation value, but how I should change it in the same array? Is that possible?
Thank you very much!
 
 
Last edit: 1 year 23 hours ago by Episteme Investigación e Intervención Social.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 22 hours ago #242805 by tpartner
Use multiple questions and a little CSS to make them appear as one.

Cheers,
Tony Partner

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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 22 hours ago - 1 year 22 hours ago #242806 by Joffm
Hi, reading the "Calculo de indices" you want to calculate a mean of all subquestions.
This you can do easily with a question of type "equation".

First rename the codes of your subquestions.
E.g.
R01, R02, R03,... for the "regular" items
I01,I02,I03,...for the "inverse" items.

Now you calculate the mean (the index) with (if the question code is "Q1") in your question of type "equation"
{sum(sum(that.Q1.sq_R.NAOK),6*count(that.Q1.sq_I.NAOK)-sum(that.Q1:sq_I.NAOK))/count(that.Q1.NAOK)}

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 22 hours ago by Joffm.

Please Log in to join the conversation.

  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
1 year 20 hours ago #242808 by tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl

Please Log in to join the conversation.

  • Episteme Investigación e Intervención Social
  • Episteme Investigación e Intervención Social's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 5 hours ago #242823 by Episteme Investigación e Intervención Social
Replied by Episteme Investigación e Intervención Social on topic How to change response code depending subquestion in an Array
Hi Joffm,
I loved your solution. I tried it and there's some kind of error I think with this part of the code: 
 
I send you the .lsg format anyway.
 

File Attachment:

File Name: Arrayequat...ints.lsg
File Size:23 KB

I really appreciate it

Please Log in to join the conversation.

  • Episteme Investigación e Intervención Social
  • Episteme Investigación e Intervención Social's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 5 hours ago #242826 by Episteme Investigación e Intervención Social
Replied by Episteme Investigación e Intervención Social on topic How to change response code depending subquestion in an Array
Thanks tpartner. I don't know how to do a CSS to show them that way. Is there a prestablished way to do it in Lime? That could be a nice solution tho. Thanks

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 4 hours ago - 1 year 1 hour ago #242829 by Joffm
This is a small typo.
It's not a colon but a dot.

And for the other way to merge several questions by css,
search for classes "no-question" and "no-bottom".

And, please, do neither provide lsq  nor lsg exports. Only lss.

Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 1 hour ago by Joffm.

Please Log in to join the conversation.

  • Episteme Investigación e Intervención Social
  • Episteme Investigación e Intervención Social's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 1 hour ago #242837 by Episteme Investigación e Intervención Social
Replied by Episteme Investigación e Intervención Social on topic How to change response code depending subquestion in an Array
Hi,
I corrected the typo but I think that still doesn't work.
I attach the .lss file.
Thanks a lot.
 

File Attachment:

File Name: Arraywithe...ints.lss
File Size:37 KB

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 53 minutes ago - 1 year 53 minutes ago #242839 by Joffm
Not surprising if you enter the equation here
 

As the tooltip says, this is used to store a value in the database, but not display it.
You may use this, if you want to display something with one equation, but store a different value in the database.

To show your result, please here
 

Then you get
 

And you should use the "round()" function not to display values like 2.93125467312

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 53 minutes ago by Joffm.

Please Log in to join the conversation.

  • Episteme Investigación e Intervención Social
  • Episteme Investigación e Intervención Social's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 5 minutes ago #242842 by Episteme Investigación e Intervención Social
Replied by Episteme Investigación e Intervención Social on topic How to change response code depending subquestion in an Array
It worked! That will help a lot with my research.
Thanks Joffm.

Please Log in to join the conversation.

  • Episteme Investigación e Intervención Social
  • Episteme Investigación e Intervención Social's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
11 months 4 weeks ago #242933 by Episteme Investigación e Intervención Social
Replied by Episteme Investigación e Intervención Social on topic How to change response code depending subquestion in an Array
One more thing. I would like to calculate other scales with other items and scores so I would like to fully understand your equation to be able to do others. If you can clarify this it would be very helpful.

In this case, your equation looks like this:

{sum(sum(that.Q1.sq_R.NAOK),6*count(that.Q1.sq_I.NAOK)-sum(that.Q1.sq_I.NAOK))/count(that.Q1.NAOK)}

that means:
(Regular items + (6*Irregular items)) - (Irregular items) / All 12 items

There are 5 regular items (a,d,e,i,k) and 7 irregular (rest)

If I have a scale with, e.g., 10 items, 7 regular and 2 irregular. How the equation should be?

I appreciate your help.

Please Log in to join the conversation.

  • Episteme Investigación e Intervención Social
  • Episteme Investigación e Intervención Social's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 months 1 day ago #246074 by Episteme Investigación e Intervención Social
Replied by Episteme Investigación e Intervención Social on topic How to change response code depending subquestion in an Array
One more thing. I would like to calculate other scales with other items and scores so I would like to fully understand your equation to be able to do others. If you can clarify this it would be very helpful.

In this case, your equation looks like this:

{sum(sum(that.Q1.sq_R.NAOK),6*count(that.Q1.sq_I.NAOK)-sum(that.Q1.sq_I.NAOK))/count(that.Q1.NAOK)}

that means:
(Regular items + (6*Irregular items)) - (Irregular items) / All 12 items

There are 5 regular items (a,d,e,i,k) and 7 irregular (rest)

If I have a scale with, e.g., 10 items, 7 regular and 2 irregular. How the equation should be?

I appreciate your help.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose