Welcome, Guest
Username: Password: Remember me

TOPIC: Take Equation Result into Numerical Input

Take Equation Result into Numerical Input 2 years 5 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.

Re: Take Equation Result into Numerical Input 2 years 5 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.

Re: Take Equation Result into Numerical Input 2 years 5 months ago #79777

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
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.

Re: Take Equation Result into Numerical Input 2 years 5 months ago #79782

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6429
  • Thank you received: 840
  • Karma: 249
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.

:)
The administrator has disabled public write access.

Re: Take Equation Result into Numerical Input 2 years 5 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.
Moderators: ITEd
Time to create page: 0.106 seconds
Donation Image