Is there a universal way to get current question's value?

Mehr
1 Jahr 9 Monate her #144349 von vkuzmin
vkuzmin erstellte das Thema Is there a universal way to get current question's value?
Is there a universal way to get current question's value?
For example, i have 10 Short text questions named Q1-Q10. To check that their value isnt "1" i can type next string in Advanced settings - Logic - Question validation equation for every question:

Q1.NAOK!=1

I can get current question's ID with {SGQ}, but SGQ.value!=1, SGQ.NAOK!=1 or INSERTANS:SGQ!=1 won't work. Is there nothing like {CURRENT} that meat current question? I've tried also just '!=1' without left part but it won't work too.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 9 Monate her - 1 Jahr 9 Monate her #144352 von Joffm
Joffm antwortete auf das Thema: Is there a universal way to get current question's value?
Hi, vkuzmin,
what do you want to do?
You want to validate the input when clicking "Next".

So, in the Validation field you do NOT enter the question ID, just the validation.
And according to the manual, short text is validated by a regular expression. See:
https://manual.limesurvey.org/Question_type_-_Short_free_text#Validation_.28using_regular_expressions.29_.28preg_validation.29

And if it is just a short text question put the validation into "General Options" / Validation"
E.g. this regular expression allows exactly one digit from 2 to 9.
/^[2-9]{1}$/
Best regards
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Letzte Änderung: 1 Jahr 9 Monate her von Joffm. Begründung: Ergänzung

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 9 Monate her #144360 von tpartner
tpartner antwortete auf das Thema: Is there a universal way to get current question's value?
In a short-text question, you can use the "self" variable to return the current question value - manual.limesurvey.org/Expression_Manager....27that.27_variables

self != 1

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: vkuzmin

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Jahr 9 Monate her #144368 von vkuzmin
vkuzmin antwortete auf das Thema: Is there a universal way to get current question's value?

tpartner schrieb:

self != 1

Thank you! This is exactly what i need.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha