Take Equation Result into Numerical Input

More
5 years 1 month ago #79772 by ARamirez
ARamirez created the topic: Take Equation Result into Numerical Input
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.

Please Log in to join the conversation.

More
5 years 1 month ago #79775 by ARamirez
ARamirez replied the topic: Take Equation Result into Numerical Input
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}

Please Log in to join the conversation.

More
5 years 1 month ago #79777 by TMSWhite
TMSWhite replied the topic: Take Equation Result into Numerical Input
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.

Please Log in to join the conversation.

More
5 years 1 month ago #79782 by DenisChenu
DenisChenu replied the topic: Take Equation Result into Numerical Input

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.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 1 month ago #79814 by ARamirez
ARamirez replied the topic: Take Equation Result into Numerical Input
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.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now