- Posts: 6
- Thank you received: 0

- Forum
- English support forums
- Design issues
- How to do calculation base on the answer of previous questions.

# How to do calculation base on the answer of previous questions.

3 years 1 month ago - 3 years 1 month ago #112739
by tuguy83

tuguy83 created the topic: How to do calculation base on the answer of previous questions.

Dear all,

I need to design a question base on the answer of previous questions.

First I ask respendents' distance to work. Than my next question is if the respondents accept "distance to work" is 10 kilometers further if the road condition change. And it is a table!

For example

I want the real number of "current distance + 10km" appear in the case below "choice 2".

I try to use {INSERTANS:49343X809X2152}, than sum{{INSERTANS:49343X809X2152}, 100}, and it doesn't work.

I want to do this because compare with seeing "n kilometer further", the respondents may behave differently when they see the real number.

Could any one give me a solution please?????

Thanks!

I need to design a question base on the answer of previous questions.

First I ask respendents' distance to work. Than my next question is if the respondents accept "distance to work" is 10 kilometers further if the road condition change. And it is a table!

For example

choice 1 (I put their current distance) | choice 2 (10 km further) |

{INSERTANS:49343X809X2152} | {sum({INSERTANS:49343X809X2152}, 100)} |

I want the real number of "current distance + 10km" appear in the case below "choice 2".

I try to use {INSERTANS:49343X809X2152}, than sum{{INSERTANS:49343X809X2152}, 100}, and it doesn't work.

I want to do this because compare with seeing "n kilometer further", the respondents may behave differently when they see the real number.

Could any one give me a solution please?????

Thanks!

Last Edit: 3 years 1 month ago by tuguy83.

Please Log in to join the conversation.

3 years 1 month ago #112740
by Ben_V

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4

Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1

Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Ben_V replied the topic: How to do calculation base on the answer of previous questions.

Try:

- to use question code instead {INSERTANS}

=> {sum(PREVIOUS_QUESTION_CODE, 100)}

OR

- remove {} around INSERTANS:49343X809X2152

=> {sum(INSERTANS:49343X809X2152, 100)}

.

- to use question code instead {INSERTANS}

=> {sum(PREVIOUS_QUESTION_CODE, 100)}

OR

- remove {} around INSERTANS:49343X809X2152

=> {sum(INSERTANS:49343X809X2152, 100)}

.

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4

Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1

Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

3 years 1 month ago - 3 years 1 month ago #112742
by tuguy83

tuguy83 replied the topic: How to do calculation base on the answer of previous questions.

Thank you very much for your answer.

But I haven't succeed yet.

I have tried both, I entre a "current distance = 111 km" than it appears in the table:

with both of them.

But I haven't succeed yet.

I have tried both, I entre a "current distance = 111 km" than it appears in the table:

choice 1 (current) | choice 2 (10 km futher) |

111 | {sum(111, 10)} |

with both of them.

**How can I have "121" in the table instead of "{sum(111, 10)}"?**
Last Edit: 3 years 1 month ago by tuguy83.

Please Log in to join the conversation.

3 years 1 month ago #112746
by Ben_V

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4

Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1

Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Ben_V replied the topic: How to do calculation base on the answer of previous questions.

I don't really know! it should work!

What's the question type for your array?

Which version of LS are you using?

Maybe:

try with a "huge free text" question type...

only paste {sum(q1, 100)}

/!\ obviously replace q1 by your correct question code for the entered number

.

What's the question type for your array?

Which version of LS are you using?

Maybe:

try with a "huge free text" question type...

only paste {sum(q1, 100)}

/!\ obviously replace q1 by your correct question code for the entered number

.

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4

Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1

Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

3 years 1 month ago #112749
by tuguy83

The question type is numerical input.(for asking distance)

The question type for the choice is Array (Multi Flexible) (Text) where there is this table.

I tried {sum(q1, 100)}, than in the table it appears "{sum(q1, 100)}".

I tried {sum(INSERTANS:49343X809X2152, 100)}, than in the table it appears "{sum(INSERTANS:49343X809X2152, 100)}"

tuguy83 replied the topic: How to do calculation base on the answer of previous questions.

Ben_V wrote: I don't really know! it should work!

What's the question type for your array?

Which version of LS are you using?

Maybe:

try with a "huge free text" question type...

only paste {sum(q1, 100)}

/!\ obviously replace q1 by your correct question code for the entered number

.

The question type is numerical input.(for asking distance)

The question type for the choice is Array (Multi Flexible) (Text) where there is this table.

I tried {sum(q1, 100)}, than in the table it appears "{sum(q1, 100)}".

I tried {sum(INSERTANS:49343X809X2152, 100)}, than in the table it appears "{sum(INSERTANS:49343X809X2152, 100)}"

Please Log in to join the conversation.

3 years 1 month ago #112751
by Ben_V

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4

Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1

Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Ben_V replied the topic: How to do calculation base on the answer of previous questions.

and if you place {sum(q1, 100)} in the question text it works or not?

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4

Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1

Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

3 years 1 month ago - 3 years 1 month ago #112752
by tuguy83

tuguy83 replied the topic: How to do calculation base on the answer of previous questions.

I edited this choice table in the question text. And I also tried to past it directly outside the table. It appears "{sum(a5,10)}",the question number is a5.

I'm using a online version (1.87) provide by our research institute. I'm a beginner, and I'm also the only user of limesurvey in our Lab.

Thank you for all your answers. I really appropriate all your help.

I'm using a online version (1.87) provide by our research institute. I'm a beginner, and I'm also the only user of limesurvey in our Lab.

Thank you for all your answers. I really appropriate all your help.

Ben_V wrote: and if you place {sum(q1, 100)} in the question text it works or not?

Last Edit: 3 years 1 month ago by tuguy83.

Please Log in to join the conversation.

3 years 1 month ago #112753
by Ben_V

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4

Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1

Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Ben_V replied the topic: How to do calculation base on the answer of previous questions.

OK !!! to use this kind of syntax you need a recent LS release, for the less greater than 1.92....

with 1.87 you have to use ONLY javascript functions; More complicated..

It's probably time to ask your research institute to update to a recent version (or to install a 2nd platform)

with 1.87 you have to use ONLY javascript functions; More complicated..

It's probably time to ask your research institute to update to a recent version (or to install a 2nd platform)

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4

Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1

Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

3 years 1 month ago #112754
by holch

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.

Some helpful links: Manual (EN) | Question Types | Workarounds

holch replied the topic: How to do calculation base on the answer of previous questions.

OK, this explains a lot. You are trying to use a feature (Expression Manager), that was not yet available in your version (as far as I know it came in 1.9x). You'll probably have to do a JavaScript solution.

By the way: I can't believe your research institute is still on 1.87. You should seriously consider to update, because Limesurvey has gone a long way since then and the differences are like day and night.

Additionally I doubt that the 1.8x versions still receive security updates. It is not that big of a deal to install the new version and it is really worth it. You should talk to the person responsible there.

By the way: I can't believe your research institute is still on 1.87. You should seriously consider to update, because Limesurvey has gone a long way since then and the differences are like day and night.

Additionally I doubt that the 1.8x versions still receive security updates. It is not that big of a deal to install the new version and it is really worth it. You should talk to the person responsible there.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.

Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.