Welcome to the LimeSurvey Community Forum

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

storing computed values

  • ditkar
  • ditkar's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 11 months ago #166690 by ditkar
storing computed values was created by ditkar
I have this scenario:

Q01: Which you favorite sports?(Select Only One)
SA1-Cricket
SA2-Tennis
SA3- Football

Q02: What all activities do you in a day?(Multiple choice)
AC1- Running
AC2- Gym
AC3- Swimming
AC4- Outdoor Games
AC5- Walking

Q03: What is total sleep time you get?(Select Only One)
ST1- 6 hours
ST2- 7 hours
ST3- 8 hours


I would like to save some computed values to the database based on the selections made on the above questions. I would probably have following data to be saved.
Misc1 = Q01_SA1 & Q03_ST2
Misc2 = Q01_SA1 & Q03_ST3
Misc3 = Q01_SA3 & Q02_AC4 & Q03_ST1
Misc4 = Q01_SA3 & Q03_ST2
Misc5 = Q01_SA2 & Q03_ST2

How can I achieve the above?
Should I be creating 5 hidden questions with type as Equation and add logic to it?
Will hiding the questions process the logic upon survey submission?
Is there a way to check the data/responses collected in Preview Survey mode?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #166692 by Joffm
Replied by Joffm on topic storing computed values

Should I be creating 5 hidden questions with type as Equation and add logic to it?

Yes

Will hiding the questions process the logic upon survey submission?

Yes

Is there a way to check the data/responses collected in Preview Survey mode?

Not the data collected (in preview mode there is nothing collected), but you can see the result by displaying your equation questions.

But which values do you want to save in Misc1, Misc2,...?
Misc1: If somebody plays cricket for 7 hours, Misc1 has the value "1", otherwise "0" ? Or?
So you would have an equation called "Misc1" like:
{if(Q1=="SA1" && Q3=="ST2",1,0)}

Or for Misc3:
{if(Q1=="SA3" && Q2_AC4=="Y" && Q3=="ST1",1,0)}

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • ditkar
  • ditkar's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 11 months ago #166696 by ditkar
Replied by ditkar on topic storing computed values
Joffm - Thanks for the quick reply. It indeed resolved my queries. And yes, Misc will save either 1 or 0.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose