Variable always +1

More
10 months 1 week ago #158451 by Marv12
Marv12 created the topic: Variable always +1
Hi,

is it possible to define a variable in the beginning with the value "0" and then after each question add "1" to this variable?

Please Log in or Create an account to join the conversation.

More
10 months 1 week ago #158463 by tpartner
tpartner replied the topic: Variable always +1
You could put an equation type question in the first group with a value of 0 and then increment it with equation questions in every subsequent group, using the assignment operator.

manual.limesurvey.org/Expression_Manager..._Assignment_Operator

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: LouisGac

Please Log in or Create an account to join the conversation.

More
10 months 1 week ago #158493 by DenisChenu
DenisChenu replied the topic: Variable always +1
I don't like to use a Equation question type for the counter, prefer an numeric questioin type with default value 0 :)

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 or Create an account to join the conversation.

More
10 months 1 week ago #158509 by tpartner
tpartner replied the topic: Variable always +1
Why?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
10 months 1 week ago #158511 by DenisChenu
DenisChenu replied the topic: Variable always +1
Because, for example : if you have index activated : Equation can be resetted when submit.
In fact Equation is resetted each time "step" is done (move previous for example).

With a default value : it's set only if it's null :) or not set.

I think reload survey can reset the value too (to be tested).

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 or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!