Welcome to the LimeSurvey Community Forum

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

Calculating the value of the third form field from two entered values

  • krizis
  • krizis's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 7 months ago - 3 years 7 months ago #205541 by krizis
Hello! Just started learning Limesurvey, what am I doing wrong (Limesurvey Version 3.22.20)

Example: I want to count downtime of employees
1 question (N1): How many times do you smoke (enter a number)
Question 2 (N2): How many times do you go to drink tea (number input)
Question 3 (N3) displays its running time: {8*60-n1*10-n2*15} - Question type: Display text or Short free text)

If you enter a formula in the question field, then everything is considered good.

What needs to be done to get this result into BD, tried to insert
Code:
8*60-n1*10-n2*15
in the general options -> relevance equation, it did not work

All 3 values are needed

Thank you in advance
Last edit: 3 years 7 months ago by krizis.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 7 months ago #205542 by Joffm
Hi,
at the moment you only display the result.
But you have to use a question of type "equation" to create a new variable that is stored.
Then instead of calculating the value again you may use this equation to display in the "text display" question.

Like
N1
N2
eqResult: {480 -10*N1 -15*N2} (if there are no missing brackets in your formula)
N3: And the result is: {eqResult}

in the general options -> relevance equation, it did not work

No, of course not. The relevance equation is something quite different.
Here you decide if a group/question/subquestion is displayedf or not.
manual.limesurvey.org/ExpressionScript_E...ation.2FBranching.29

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: krizis
The topic has been locked.
  • krizis
  • krizis's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 7 months ago #205544 by krizis
Thank you very much, everything worked out.
It turns out that you just need to choose the right type of question.
Great description and example manual.limesurvey.org/Question_type_-_Equation
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose