Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Take Equation Result into Numerical Input

Take Equation Result into Numerical Input 4 years 6 months ago #79772

  • ARamirez
  • ARamirez's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Hi, I'm having trouble to achieve this:

I have an Equation question that is:

{sum (question1.value,question2.value)} and prints the result ok to the database, but in "text" database table type.

What I need is the same result, but saved to database in "real" database type, as "numerical input" does in LimeSurvey.

The problem is that I can't find the way to make this equation to work in "numerical input" type question, neither to save it as a default answer, up to now I have tried without success:

- Place equation in text of question
- Place equation in default answer
- Place EQUATIONRESULT.value in default answer
- Place INSERTANS in default answer

What can I do to solve this?

Thanks for your help.
The administrator has disabled public write access.

Take Equation Result into Numerical Input 4 years 6 months ago #79775

  • ARamirez
  • ARamirez's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Just a note, I finally managed to solve it with the use of INSERTANS, I'm leaving the way I did it in the case somebody else needs it:

Basically what I did was to place {INSERTANS.NAOK} as default answer but in a bolck of questions after the block of questions that handled the results, so the results of "Block A" are stored in the first hidden question of "Block B" with numerical input and using {INSERTANS(QUESTIONCODE).NAOK}
The administrator has disabled public write access.

Take Equation Result into Numerical Input 4 years 6 months ago #79777

  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 758
  • Thank you received: 84
  • Karma: 37
You could add this as an enhancement request.

The Equation question type always stores as text right now to give maximum flexibility. Perhaps the "numbers_only" option could be added to that question type, in which case the database would store the result as double; and "integer_only" could be used to force storing it as an integer.
The administrator has disabled public write access.

Take Equation Result into Numerical Input 4 years 6 months ago #79782

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9551
  • Thank you received: 1370
  • Karma: 389
TMSWhite wrote:
You could add this as an enhancement request.

The Equation question type always stores as text right now to give maximum flexibility. Perhaps the "numbers_only" option could be added to that question type, in which case the database would store the result as double; and "integer_only" could be used to force storing it as an integer.
I think too of a "multi equation" question type.

:)
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time (Need support ?).
A bug not reported is a bug not corrected. | 2.61lts version improved | Need plugins for LimeSurvey ?
The administrator has disabled public write access.

Take Equation Result into Numerical Input 4 years 6 months ago #79814

  • ARamirez
  • ARamirez's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Yes, it would be useful to have the option of getting the result of an arithmetic equation in number type table.

Anyway, it looks like is working ok with the INSERTANS trick, although we had to write several hidden extra questions to get the same results converted to number table, but it works.

Thanks for your answers.
The administrator has disabled public write access.
Time to create page: 0.241 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form