Actions

Setting conditions/sl: Difference between revisions

From LimeSurvey Manual

(Updating to match new version of source page)
(Updating to match new version of source page)
Line 1: Line 1:
<languages /> __TOC__
<languages /> __TOC__


=Pregled pogojev v LimeSurvey-u=
=Pregled pogojev v LimeSurvey-u=


LimeSurvey has a very powerful logical branching feature. It can be accessed by clicking on the '''Set conditions''' button - [[File:conditions_icon.png]] - located on each [[Question bar options|question bar]].
LimeSurvey has a very powerful logical branching feature. It can be accessed by clicking on the '''Set conditions''' button - [[File:conditions_icon.png]] - located on each [[Question bar options|question bar]].
Line 8: Line 10:
* what conditions you can find in LimeSurvey
* what conditions you can find in LimeSurvey
* what you can and can't do with conditions
* what you can and can't do with conditions
* what steps you need to learn to setup simple or more complex conditions
* what steps you need to learn to set up simple or more complex conditions


For step-by-step video instructions check out [http://www.youtube.com/watch?v=oexr0z-eo9U this tutorial] or download the condition sample survey: [[Media:LimeSurvey_Survey_Setting_Conditions.zip|LimeSurvey_Survey_Setting_Conditions.zip]].
For step-by-step video instructions check out [http://www.youtube.com/watch?v=oexr0z-eo9U this tutorial] or download the condition sample survey: [[Media:LimeSurvey_Survey_Setting_Conditions.zip|LimeSurvey_Survey_Setting_Conditions.zip]].
{{Hint|Text=The conditions functionalities work like a GUI for [[Expression Manager|the expressions and equations that can be applied to questions]], allowing the users to easily increase the complexity of their surveys without getting into expressions and relevance equations. However, [[Expression Manager|the Expression Manager]] must be studied/known to increase the range of options that is available within LimeSurvey.}}


==Hide/Show Branching Versus Jump Branching==
==Hide/Show Branching Versus Jump Branching==


LimeSurvey vam omogoča izdelati logiko razvejanosti. Določite lahko, da bodo nekatera vprašanja prikazana le, če so izpolnjeni nekateri pogoji (primer: Prikaži vprašanje X, če je vprašanje Y bilo odgovorjeno z možnostjo Z).
LimeSurvey vam omogoča izdelati logiko razvejanosti. Določite lahko, da bodo nekatera vprašanja prikazana le, če so izpolnjeni nekateri pogoji (primer: Prikaži vprašanje X, če je vprašanje Y bilo odgovorjeno z možnostjo Z).
Line 18: Line 25:
Ideja je, da izvedemo "Prikaži/Skrij razvejanost podvprašanj":
Ideja je, da izvedemo "Prikaži/Skrij razvejanost podvprašanj":
* Pri vsakem vprašanju v anketi lahko definirate pogoj ali niz pogojev: vprašanje se prikaže, če je pogoj izpolnjen
* Pri vsakem vprašanju v anketi lahko definirate pogoj ali niz pogojev: vprašanje se prikaže, če je pogoj izpolnjen
<center>[[File:simple-condition-on-yes-question.png]]</center>


<div class='simplebox'> [[File:help.png]] Simply put:
<div class='simplebox'> [[File:help.png]] Simply put:
* a question without a condition defined on it will always be displayed
* a question without a condition defined on it will always be displayed;
* a question with a condition defined on it will not be displayed unless the condition is met</div>
* a question with a condition defined on it will not be displayed unless the condition is met.</div>


This approach is different from the '''Jump Branching Logic''' that is sometimes implemented by other software. In the '''Jump Branching Logic''', the resulting action of a met condition would be to jump to another question (that is to say hide all questions in between). '''LimeSurvey doesn't implement this Jump Branching Logic''' method. Instead, if you wish to jump a series of questions, you should simply set the same condition on all the questions you do not wish to be displayed. For example, if the jump condition you want to set on Question2 is "Jump to Question5 if the answer to Question1 is 'Yes'", you can simply:
This approach is different from the '''Jump Branching Logic''' that is sometimes implemented by other software. In the '''Jump Branching Logic''', the resulting action of a met condition would be to jump to another question (that is to say hide all questions in between). '''LimeSurvey doesn't implement this Jump Branching Logic''' method. Instead, if you wish to jump a series of questions, you should simply set the same condition on all the questions you do not wish to be displayed. For example, if the jump condition you want to set on Question2 is "Jump to Question5 if the answer to Question1 is 'Yes'", you can simply:
*set a condition on questions 2, 3 and 4 to only display "if the answer to Question1 was NOT 'Yes'"
*set a condition on questions 2, 3 and 4 to only display "if the answer to Question1 was '''NOT''' 'Yes'"


LimeSurvey makes setting the same condition on multiple questions (and thus implementing '''Jump Branching Logic''') easy by allowing you to "copy" a condition from one question to a series of others. In the above example, you would begin by setting the condition on Question2, then from the same screen, you would copy that condition to Question3 and Question4.


<center>[[File:simple-condition-on-yes-question.png]]</center>
<div class='simplebox'> [[File:help.png]] To find out more details on how you can copy conditions within LimeSurvey, please continue reading the following [[Setting conditions#How to copy conditions|wiki section]].</div>




LimeSurvey makes setting the same condition on multiple questions (and thus implementing '''Jump Branching Logic''') easy by allowing you to "copy" a condition from one question to a series of others. In the above example, you would begin by setting the condition on Question2, then from the same screen you would copy that condition to Question3 and Question4.
==Veljavni tipi pogojev==


==Veljavni tipi pogojev==


Basically, a condition can compare values, returning either true or false.
Basically, a condition can compare values, returning either true or false.


The values that can be compared are '''answers to previous questions'''. For instance, If you answered 'Yes' to Question1, you Question2 will then be showed to the survey respondent:
The values that can be compared are '''answers to previous questions'''. For instance, if you answer 'Yes' to Question1, Question2 will then be showed to the survey respondent:




Line 51: Line 61:
* a simple question (for all question types apart from Array questions)
* a simple question (for all question types apart from Array questions)
** for instance: text questions, radio or dropdown lists, and even multiple choices questions
** for instance: text questions, radio or dropdown lists, and even multiple choices questions
* or a row in Array questions (except for Array dual scale and Array Multiple Flexible questions),
* or a row in Array questions (except for Array dual scale and Array multiple flexible questions)
** for instance: Array of 5 radio buttons, array with label questions
** for instance: array with 5 radio buttons or array with label questions
* or either the left part or the right part of an Array dual scale question
* or either the left part or the right part of an Array dual scale question
* or each cell of an Array Flexible question
* or each cell of an Array flexible question
 
{{Note|Check the following [[Question types|link]] to find out more about the available question types in LimeSurvey.}}


As a matter of simplification, ''question-entries'' are just called "Question" in this document and the condition editor.
* '''constant values'''
* '''constant values'''
** for instance: "If you answered more than 18 years to Question2"
** for instance: "If you answered more than 18 years to the question below"




Line 64: Line 75:




* '''Participant's profile data:''' To use data from the survey participants table, "Anonymized responses" must be set to NO.  This option can be found in survey participant settings tab.
* '''Participants' profile data:''' To use data from the survey participants table, "Anonymized responses" must be set to '''NO'''.  This option can be found in survey [[Participant settings|participant settings]] panel.




Line 70: Line 81:




Several comparison operators are supported from the simple "equals", to the advanced "Regular Expression":
<hr width="50%" style="margin:auto">
* The basic ones are equality, and inequality
 
* The greater/less than operator family is also available, and is usually only useful when using numeric question-entries
 
** Please note that comparisons on numeric fields honor the numeric order: for instance 2 < 10
Several comparison operators are supported - from the simple "equals" to the advanced "regular expression":
** If you're using a question entry whose type is text, then the condition could be evaluated as "2" > "10" (string order)!
* The basic ones refer to the "equal" and "not equal to" operations
* The ''greater/less than'' operator family is also available, and is usually used when using numeric question-entries
** Please note that comparisons on numeric fields make use of the numeric order. For instance, 2 < 10
** If you're using a question entry whose type is text, the condition could be evaluated as "2" > "10" (string order)!
** Numeric questions, as well as text questions (when they have the 'numbers_only' attribute set), will use the numeric order for comparisons
** Numeric questions, as well as text questions (when they have the 'numbers_only' attribute set), will use the numeric order for comparisons
* An advanced comparison operator using regular expressions is also available.
* An advanced comparison operator using regular expressions is also available (don't panic! If you don't know what this means, then you don't need it)
* The "Regular Expression" operator (don't panic: If you don't know what this means, then you don't need it)
** the pattern is '''not''' to be enclosed in '/' characters
** the pattern is '''not''' to be enclosed in '/' characters
** for instance: '''[a-zA-Z]$'''
** for instance: '''[a-zA-Z]$'''


==Kako lahko združimo pogoje==
==Kako lahko združimo pogoje==
Sestavimo lahko '''kompleksne pogoje''' s '''kombinacijo preprostih pogojev''' z logičnimi operatorji '''IN''' in '''ALI'''.




<center>[[File:simple-conditions-combination.png]]</center>
<center>[[File:simple-conditions-combination.png]]</center>


Sestavimo lahko '''kompleksne pogoje''' s '''kombinacijo preprostih pogojev''' z logičnimi operatorji '''IN''' in '''ALI'''.


Zavedati se moramo, da '''LimeSurvey avtomatično določi kateri logični operator uporabiti''': to pomeni, da se uporaba operatorja '''IN''' ali '''ALI''' določi '''glede na kontekst''' pogoja.
Zavedati se moramo, da '''LimeSurvey avtomatično določi kateri logični operator uporabiti''': to pomeni, da se uporaba operatorja '''IN''' ali '''ALI''' določi '''glede na kontekst''' pogoja.


We'll talk about complex conditions [[Setting_conditions#Using_ORed_conditions_between_different_questions:_the_use_of_scenario|later]], but let's start by the simple ones first.
We'll talk more about complex conditions [[Setting_conditions#The usage of scenarios - Using ORed conditions between different questions|later]]. Let's first focus together on the elementary ones.


=Spoznavanje preprostih pogojev: osnovni pogoji=


==Dostop do urejevalnika==
==Dostop do urejevalnika==


First you need to access the condition editor:
* open the condition menu by clicking on the ''conditions icon'' in the question button bar, when viewing a question.
* then click on the ''Add and edit conditions icon'', the edit conditions screen will appear allowing you to create, edit or delete conditions for the current question.


Prikaže se nam naslednja slika:
First, you need to access the [[Question bar options#Set conditions|conditions designer]]. To do that, click on the question you wish to apply the condition to:
 
 
<center>[[File:Question designer search question.png]]</center>
 
 
Now, look for the '''Set conditions''' button located on the top question bar:
 
 
<center>[[File:Question designer set conditions.png]]</center>
 
 
Once accessed, the following page will be displayed:
 
 
<center>[[File:Question designer top.png]]</center>
 
 
The conditions designer panel can be divided into three sections:
* [[Setting conditions#The conditions designer toolbar|The conditions designer toolbar]]
* [[Setting conditions#Overview of the existent conditions|The current existent question conditions]]
* [[Setting conditions#Add/Edit conditions|Add/edit condition menu]]
 
 
==The conditions designer toolbar==
 
 
You may find on the toolbar the following options:
 
 
<center>[[File:Show conditions designer toolbar.png]]</center>
 


*'''Show conditions for this question''': Click on this button to get a quick overview of the current existent conditions that are applied to your question.


<center>[[File:edit-conditions-EditorView.png]]</center>
*'''Add and edit conditions''': It represents the default page that opens automatically once you click the '''Set conditions''' button. It is divided in two parts: (1) a table displaying all the existent conditions and scenarios, and (2) the [[Setting conditions#Add/Edit conditions|add/edit conditions menu]].
 
*'''Copy conditions''': Sometimes, you wish to apply the same condition to X questions in order to get questionY displayed at the end. For this, click on '''Copy conditions'''. A new window will open displaying the current existent conditions added to your question (let's call it question3). To add them to question5, check the desired conditions you wish to be copied, select question5, and click on the '''Copy conditions''' button located on the bottom left part of the panel. For further information, please continue reading the following [[Setting conditions#How to copy conditions|wiki section]].
 
*'''Save and close''': Once you are done with the changes, click '''Save and close''' to get your conditions saved.
 
*'''Move to question''': In order not to leave the conditions designer panel while moving to another question, use the following option to select from the dropdown list the next question you wish to apply conditions to. Please note that the dropdown list displays the questions that are displayed in the survey before and after the current question.
 
*'''Close''': If you wish to exit the panel without performing any changes, you can either go straight to the settings/structure tab and select the desired option or click '''Close''', which is located in the upper right of the screen.
 
 
==Overview of the existent conditions==
 
 
This section displays a table that contains all the existent scenarios and conditions of a question. Certain actions can be performed from here:
 
 
<center>[[FIle:Show conditions for this questions pic.png]]</center>
 
 
*In the top right part, three actions are available:
**Quick-add conditions - it fastens the process of adding conditions (read [[Setting conditions#Add/Edit conditions|below]] to learn about all the options)
**Renumber scenarios - if clicked, the scenarios will be renumbered with incremental numbers beginning from one. Please note that this option is displayed only if two or more scenarios are applied to your question.
**Delete all conditions - you can delete via this action all the current existent conditions and scenarios applied to your question.
 
 
<center>[[FIle:Conditions designer quickadd and delete.png]]</center>
 
 
*Besides the id number of each scenario there are three buttons that allow you to perform the following actions:
**Delete scenario
**Change scenario number
**Add condition to this scenario - click on this button to add another condition to the desired scenario
 
 
<center>[[FIle:Conditions Designer table scenarios.png]]</center>
 
 
*Two actions can be performed on each condition:
**Delete condition
**Edit condition - if clicked, you will be able to edit the condition from the [[Setting conditions#Add/Edit conditions|conditions menu]]
 
 
<center>[[FIle:Conditions Designer table conditions.png]]</center>
 
==Add/Edit conditions==
 
 
The bottom part of the screen is allocated to the Add/edit conditions menu:
 
 
<center>[[File:Add_edit_condition_q.png]]</center>
 
 
<div class='simplebox'> You can also edit the condition from the same location if you pressed before on the green pencil that corresponds to the question you wish to be edited (see the [[Setting conditions#Overview of the existent conditions|conditions and scenarios table]]).</div>
 
To understand how the conditions feature works in LimeSurvey, we will first present the elementary conditions.




Opomba: v tem trenutko ne spreminjajmo privzetega scenarija ([[File:default_scenario.png]]), ki je samodejno izbran v tem pogojnem obrazcu; več o tem kasneje.
Opomba: v tem trenutko ne spreminjajmo privzetega scenarija ([[File:default_scenario.png]]), ki je samodejno izbran v tem pogojnem obrazcu; več o tem kasneje.


==Opredelitev osnovnih elementov==
==Opredelitev osnovnih elementov==


Osnovni pogoj je edini pogoj brez dodatnih logičnih operaterjev IN ali ALI.
Osnovni pogoj je edini pogoj brez dodatnih logičnih operaterjev IN ali ALI.
Line 121: Line 222:




* a ''comparison operator''
If you select a question-entry (from the '''Previous questions''' tab) and if this question uses predefined answers, then the corresponding predefined answers are displayed under the '''Predefined''' tab of the comparison value selection.
** Choose the ''comparison operator'' you want to apply in the dropdown list




<center>[[File:conditions-operators.png]]</center>
<div class='simplebox'> [[File:help.png]] Note that in order to use the Token your survey must:
*not use [[Participant settings|anonymous answers]]
*use a [[Survey participants|survey participants table]] and [[Participant settings|closed access]].</div>




* a right operand: the ''comparison value''
* a ''comparison operator''. Choose the ''comparison operator'' you want to apply from the dropdown list (''less than'', ''less than or equal to'', ''equals'', ''not equal to'', ''greater than or equal to'', ''greater than'', ''[[Expression Manager|regular expression]]'').
** you can choose the ''comparison value'' type by selecting the appropriate tab in the condition editor
 
 
* a right operand: the ''comparison value''. You can choose the ''comparison value'' type by selecting the appropriate tab in the condition editor. When you create a condition, you can select as the comparison value a predefined value (answer), a constant, a question, a survey participant attribute, or a regular expression:




<center>[[File:edit-conditions-comparisonvalueTab.png]]</center>
<center>[[File:edit-conditions-comparisonvalueTab.png]]</center>
===Example of elementary conditions and how to create them===




Line 145: Line 251:




* Show question IF "the answer to Question2 was greater than the numerical value '5'"
* Show Question 'Alcohol' '''if''' "the answer to Question 'Age' is greater or equal than the numerical value '18'"
** ''tested value''= answer to Question2
** ''tested value'' = answer to Question 'Age'
** ''comparison operator''= greater than
** ''comparison operator'' = greater than or equal to
** ''comparison value''= the constant value 5
** ''comparison value'' = the constant value '18'




Line 154: Line 260:




<div class='simplebox'>'''Caution''': When using a constant 'comparison value' for a date question, you must enter the value with the YYY-MM-DD format, whatever the date format is set for current survey.<div class="simplebox">
{{Alert|title=Attention|text=When using a constant 'comparison value' for a date question, regardless of the date format set in your survey, you must use the YYYY-MM-DD date format.}}
* Show question IF "the answer to Question3 was greater than the answer to Question2"
 
** ''tested value''= answer to Question3
 
** ''comparison operator''= greater than
* Show Question 'Alcohol' '''if''' "the answer to Question 'BirthDate' is greater than 2000-01-01'''"
** ''comparison value''= answer to Question2</div>
** ''tested value'' = answer to Question 'BirthDate'
** ''comparison operator'' = Greater than or equal to
** ''comparison value'' = '2000-01-01' (the format in the constant field: 2000-01-01)




<center>[[File:edit-simple-condition-prevQuestion.png]]</center>
<center>[[File:Date time example condition.png]]</center>




* Show question IF "the 'Department' value from the participant's profile (Token Attribute from the invitation) equals the 'Accounting' string"
* Show Question 'Alcohol' '''if''' "the the 'DrinkingHistory' [[Survey participants|participant's attribute]]" matches the 'Yes' string.
** ''tested value''= the 'Department' value taken from the token invitation
** ''tested value''= the 'DrinkingHistory' value taken from the [[Survey participants#Manage attributes|survey participants table]]
** ''comparison operator''= equals
** ''comparison operator'' = equals
** ''comparison value''= the constant value 'Accounting'
** ''comparison value'' = the constant value 'Yes'
 


<center>[[File:edit-simple-condition-leftToken.png]]</center>
<center>[[File:edit-simple-condition-leftToken.png]]</center>


Podrobna navodila o zgoraj naštetih nastavitvah je mogoče najti na naslednjem blogu: "[http://www.limesurvey-consulting.com/limesurvey-conditions-based-on-token-attributes/ Conditions based on token attributes]"
=Conditions and scenarios in LimeSurvey=
 


=Privzete kombinacije pogoja=
=Privzete kombinacije pogoja=


Kot smo že povedali, LimeSurvey samodejno določi kateri logični operator (IN/ALI) bo izbran med pogoji, kar je odvisno od samega 'konteksta'.
Kot smo že povedali, LimeSurvey samodejno določi kateri logični operator (IN/ALI) bo izbran med pogoji, kar je odvisno od samega 'konteksta'.
Line 184: Line 295:
==Prvo pravilo: pogoji z isto ''preizkušeno vrednostjo'' so med seboj povezani z ALI==
==Prvo pravilo: pogoji z isto ''preizkušeno vrednostjo'' so med seboj povezani z ALI==


When you have several conditions they are '''ORed''' together if they share the same '''tested value'''
* this is the case for instance for several possible answers of the same previous question: "If answer to Question1 equals 'green' '''OR'''  answer to Question1 equals 'red'  '''OR'''  answer to Question1 equals 'blue'"


When you have several conditions, they are '''ORed''' together if they share the same '''tested value'''. This is the case if the condition applies to several answers belonging to one single question. For example, a condition was applied below to three answers belonging to the same question - if answer to Question 'FavColour' equals 'green' '''OR'''  answer to Question 'FavColour' equals 'red'  '''OR'''  answer to Question 'FavColour' equals 'blue', then Question 'BirthDate' will be displayed to the survey respondent:


<center>[[File:edit-conditions-naturalOr-edit.png]][[File:edit-conditions-naturalOr-result.png]]</center>


<center>[[File:edit-conditions-naturalOr-edit.png]]
[[File:edit-conditions-naturalOr-result.png]]</center>


==Drugo pravilo: pogoji z isto ''preizkušeno vrednostjo'' so med seboj povezani z IN==


When you have several conditions, they are '''ANDed''' together if they don't share the same '''tested values'''
<div class='simplebox'>[[File:help.png]] Note: To select multiple predefined answers, don't forget to hold the Shift or Ctrl key while selecting the '''tested values'''.</div>
* this is the case for instance for several conditions based on different previous questions: "If answer to Question1 equals '4' '''AND''' answer to Question2 equals 'green'"




[[File:edit-conditions-naturalAND-editA.png]]  [[File:edit-conditions-naturalAND-editB.png]]  [[File:edit-conditions-naturalAND-result.png]]
==Drugo pravilo: pogoji z isto ''preizkušeno vrednostjo'' so med seboj povezani z IN==




==Tretje pravilo: Osnovni pogoji ALI imajo prednost pred IN pogoji==
When you have several conditions, they are '''ANDed''' together if they don't share the same '''tested values'''. For example, you may see below the case for several conditions based on different previous questions - "If answer to Question 'Alcohol' equals 'Y' answer '''AND''' answer to Question 'Gender' equals 'F'", then Question 'Alcoholconsumption' will be displayed to the survey respondent:


Predstavljajte si, da določite naslednje 3 sklope pogojev:
*ČE je odgovor na vprašanje ''Tip !'' 'Zelena'
*ČE je odgovor na vprašanje ''Tip 5'' '4'
*ČE je odgovor na vprašanje ''Tip A'' '4' ali '5'


[[File:edit-conditions-naturalAND-editA.png]][[File:edit-conditions-naturalAND-editB.png]][[File:edit-conditions-naturalANDandOR-editC.png]]
<center>[[File:edit-conditions-naturalAND-editA.png]]  
* Zgodi se naslednje:


[[File:edit-conditions-naturalANDandOR-result.png]]
[[File:edit-conditions-naturalAND-editB.png]] </center>
**Bodite pozorni na '''ALI''' in '''in''': to pomeni, da so bili pogoji z ALI ocenjeni kot prednostni (označeni znotraj oklepaja)
 
**Poleg tega se ni ohranil vrstni red osnovnih pogojev, pravzaprav tukaj niti nima večjega pomena
<center>[[File:edit-conditions-naturalAND-result.png]]</center>
** Končni pogoj je sledeč: ČE je (odgovor na vprašanje "Tip A" '4' '''ALI  '''odgovor na vprašanje "Tip A" je '4') '''IN '''(ČE je odgovor na vprašanje "Tip 5" '4') '''IN '''(ČE je odgovor na vprašanje "Tip !" 'Zelena')




==Vprašanja z več izbirami==
==Vprašanja z več izbirami==


Opomba: Ta odstavek se nanaša na vprašanja tipa ''Več možnosti'' in ''Več možnosti s komentarjem'' in ne na ''Polja (številke)'' (pri tem tipu vprašanj je vsako potrditveno polje definirano kot posamezen vnos in se s tem ne obravnava kot preostala vprašanja z več izbirami).
Opomba: Ta odstavek se nanaša na vprašanja tipa ''Več možnosti'' in ''Več možnosti s komentarjem'' in ne na ''Polja (številke)'' (pri tem tipu vprašanj je vsako potrditveno polje definirano kot posamezen vnos in se s tem ne obravnava kot preostala vprašanja z več izbirami).


<center>[[File:edit-conditions-MultipleOptions1.png]]</center>


V urejevalniku pogojev se vprašanja tipa ''Več možnosti'' in ''Več možnosti s komentarjem'' prikažejo na dva različna načina:
V urejevalniku pogojev se vprašanja tipa ''Več možnosti'' in ''Več možnosti s komentarjem'' prikažejo na dva različna načina:
Line 227: Line 330:
* Drugi način - ''Nova možnost odgovora'': vam omogoča določite pogojev za vsak odgovor posebej
* Drugi način - ''Nova možnost odgovora'': vam omogoča določite pogojev za vsak odgovor posebej


In sedaj preizkusimo vaše pridobljeno znanje o pogojih tako, da boste poizkusili odgovoriti na naslednje vprašanje:
* Dobili ste vprašanje z več možnostmi:
** Primer A: Kako lahko določite primer pogoja ALI med različnima odgovoroma tega vprašanja
** Primer B: Kako lahko določite primer pogoja IN med različnima odgovoroma tega vprašanja


...
<center>[[File:edit-conditions-MultipleOptions1.png]]</center>
 
 
====The group of checkboxes flavour====


...


...
Now, let's focus on an example to better understand the difference between the two flavours. Let's imagine that we wish to display the 'Pointchoice' Question only if the respondent checks at least one of the ''tested answers'' listed under the 'MultipleOrganizations' Question.  


Odgovor...
As mentioned above, the group of checkboxes flavor allows you to set conditions on all possible answers of the respective question. Therefore, only the options that refer to responsibilities are selected as '''comparison values''' below:


Primer A:
* Uporabite prvi način - ''Skupina potrditvenih polj'' in izberite želene odgovore


<center>[[File:edit-conditions-MultipleOptionsOR.png]]</center>


[[File:edit-conditions-MultipleOptionsOR.png]][[File:edit-conditions-MultipleOptionsOR-result.png]]


As we can observe, the conditions get ORed due to the ''Group of checkboxes'' flavour selected in the beginning.:


Primer B:
* Uporabite drugi način - ''Nova možnost odgovora'', kjer izberite prvi odgovor, ki mu želite določiti pogoj, nato pa ''primerjalno vrednost'' nastavite na ''označeno''


<center>[[File:edit-conditions-MultipleOptionsOR-result.png]]</center>




<center>[[File:edit-conditions-MultipleOptionsAND1.png]]</center>
====ANDing conditions in multiple choice questions====




* Use the ''Single checkbox'' entry that correspond to the second answer you need to set the condition on and set the condition to the ''checked'' ''comparison value''
Now, let's focus on a similar example. However, we are looking this time only for the most active members to ask them further questions. To do this, we make use of the '''Single checkbox''' flavour which allows you to set conditions based on each checkbox individually.
 
In this example, question X will be displayed if ''A'' and ''B'' are checked:




<center>[[File:edit-conditions-MultipleOptionsAND2.png]]</center>
<center>[[File:edit-conditions-MultipleOptionsAND2.png]]</center>


<center>[[File:edit-conditions-MultipleOptionsAND3.png]]</center>


* Enjoy the result:
 
Once done, you can observe that the two conditions are ANDed now.




<center>[[File:edit-conditions-MultipleOptionsAND-result.png]]</center>
<center>[[File:edit-conditions-MultipleOptionsAND-result.png]]</center>
This means that your question will not be displayed unless both tested values (the selected subquestions) are met.




=Primer uporabe pogojev ALI med različnimi vprašanji=
=Primer uporabe pogojev ALI med različnimi vprašanji=


Now, you may argue that sometimes you need to have '''ORed''' conditions even when they are set on different questions (that is to say on different '''tested values'''): this is where scenarios can be used.


Now, you may argue that sometimes you need to have '''ORed''' conditions even when they are set on different questions (that is to say on different '''tested values'''). This is why we got scenarios!


<center>[[File:multi_scenario.png]]</center>


==Opredelitev scenarija==


==Opredelitev scenarija==


Scenarij je '''ročno ustvarjena skupina pogojev''' v katerem so pogoji neodvisno ovrednoteni od pogojev iz drugih scenarijev. Zapleteno stanje, ki izhaja iz prepletanja več scenarijev bo izpolnjeno, če bo izpolnjen le en scenarij. Z drugimi besedami: scenariji so '''logična skupina pogojev'', ki z upoštevanjem  zgoraj navedenih pravil in '''medsebojne ALI povezave''' predstavljajo zapletene okoliščine.
Scenarij je '''ročno ustvarjena skupina pogojev''' v katerem so pogoji neodvisno ovrednoteni od pogojev iz drugih scenarijev. Zapleteno stanje, ki izhaja iz prepletanja več scenarijev bo izpolnjeno, če bo izpolnjen le en scenarij. Z drugimi besedami: scenariji so '''logična skupina pogojev'', ki z upoštevanjem  zgoraj navedenih pravil in '''medsebojne ALI povezave''' predstavljajo zapletene okoliščine.
Line 281: Line 386:
Celoten zgornji opis velja znotraj posameznega scenarija. Pri tem tudi velja, da so vsi novi pogoji ustvarjeni znotraj "Prvotnega scenarija".
Celoten zgornji opis velja znotraj posameznega scenarija. Pri tem tudi velja, da so vsi novi pogoji ustvarjeni znotraj "Prvotnega scenarija".


Vendar, ko ustvarite nov osnovni pogoj, lahko določite na kateri dodatni scenarij poleg prvotnega bo še vplival.


Scenariji so označeni z navadno številko, "Prvotni scenarij" ima oznako '1', ki je njegov identifikator.
==Dodajanje vprašanja v dodaten scenarij==




==Dodajanje vprašanja v dodaten scenarij==
Ko ustvarite (ali urejate) pogoj, lahko spremenite scenarij v katerem je shranjen pogoj:


Ko ustvarite (ali urejate) pogoj, lahko spremenite scenarij v katerem je shranjen pogoj:


<center>[[File:edit-conditions-EditorView-Scenario.png]]</center>
<center>[[File:edit-conditions-EditorView-Scenario.png]]</center>


Če morate določiti pogoj v drugem scenariju kot prvotnem, kliknite na ikono Dodaj scenarij [[File:plus.png]] in vnesite številko scenarija: [[File:default_scenario_edit.png]]
Če morate določiti pogoj v drugem scenariju kot prvotnem, kliknite na ikono Dodaj scenarij [[File:plus.png]] in vnesite številko scenarija: [[File:default_scenario_edit.png]]
Line 297: Line 401:




<center>[[File:edit-conditions-EditorView-Scenario2.png]]</center>
<center>[[File:Conditions test ids.png]]</center>


=Uporaba urejevalnika=


==Pregled urejevalnika==
Številko dodeljeno scenariju lahko spremenite s klikom na ikono [[File:scenario_edit.png]]. Nato morate izpolniti obrazec, ki se pojavi v isti vrstici.


First you access the condition editor:
* open the condition menu by clicking on the ''conditions icon'' in the question button bar, when viewing a question.


Zgornji del okna vedno prikaže vse pogoje, ki so že določeni za to vprašanje:
<center>[[File:edit_scenario_conditions.png]]</center>




<center>[[File:existing_conditions.png]]</center>
Kot smo že omenili, številke scenarijev nimajo nobenega vpliva kako pogoje vrednotimo. Vendar pa je sprememba številke scenarija pomembna, ko želimo:
* določiti v kakšnem vrstnem redu želimo, da se scenariji prikazujejo v tiskani verziji anketnega vprašalnika
* združiti pogoje dveh scenarijev (v primeru združevanja scenarija 10 s scenarijem 1 le preštevilčite scenarij 10 z ID številko prvega scenarija).




V zgornjem primeru se vprašanje B prikaže samo, če je:
===Example: creating three scenarios===
* Odgovor za vnos FBI prejšnjega vprašanja A enak "1"
* IN
** ALI je odgovor za vnos CIA prejšnjega vprašanja A enak "5"
** ALI pa je odgovor za vnos CIA prejšnjega vprašanja A enak "3"


V načinu Dodajanja in urejanja pogoja [[File:conditions_add.png]] lahko urejate nekatere posebne nastavitve, ki se nahajajo v vsaki posamezni vrstici:
* uredi pogoj [[File:conditions_edit.png]]
* izbriši vse pogoje [[File:conditions_deleteall.png]], izbriši ta pogoj [[File:conditions_delete.png]], izbriši vse pogoje tega scenarija [[File:scenario_delete.png]]
* uredi scenarij [[File:scenario_edit.png]]


To create three scenarios, you need at least three conditions and to add to each of them a different scenario id. Once done, the scenarios are going to be connected among themselves via the 'OR' operator. For example, it could look like this:


<center>[[File:edit-conditions-EditModeButtons.png]]</center>


V načinu kopiranja [[File:conditions_copy.png]] je vsaka vrstica pripeta s potrditvenim poljem, ki vam omogoča izbiro tistega pogoja, ki ga želite kopirati v poznejša vprašanja:
<center>[[File:edit-conditions-EditorView-Scenario2.png]]</center>


== AND vs OR in the same scenario==


<center>[[File:copying_conditions.png]]</center>


You may end up in certain cases with AND and OR logical operators in the same scenario:


==Določitev novega pogoja==


===Najprej izberite scenarij===
<center>[[File:And vs OR example.png]]</center>


'''Če ne potrebujete pogojev ALI''' med različnimi vprašanji, '''potem ne smete spreminjati privzetega scenarija''' ([[File:default_scenario.png]]), ki je avtomatično določen v urejevalniku pogojev.


V primeru, da morate definirati pogoj tako v prvotnem kot v drugem scenariju, kliknite na ikono ''Nov scenarij'' [[File:plus.png]] in vnesite številko scenarija: [[File:default_scenario_edit.png]]
LimeSurvey will always apply first OR. For further details on this, you may check the following Wikipedia article on [https://en.wikipedia.org/wiki/Boolean_algebra Boolean algebra].


Različni scenariji lahko imajo različne ID-je, saj le ta za določen scenarij nima večjega pomena.
However. the order of operations can also be observed in the Relevance equation field. For the above example, the relevance equation is highlighted below:




===Izbira ''preizkušena vrednost''===
<center>[[File:AND vs OR relevance eq.png]]</center>


V polju ''vprašanje'' izberite ustrezen zavihek. Izbirate lahko med zavihkoma: prejšnje vprašanje (izberete tisto vprašanje na katerega želite, da se pogoj nanaša) ali polja žetona (vrednost vzeta iz profila anketiranca).


Note that '''in order to use the ''Token''''' your survey must:
As it can be observed, a set of extra parentheses is added for the OR logical operations in order to let the software know that it must be "computed" first.
* '''not use anonymous answers'''
* '''use a token table''' and closed access


Šele nato lahko izberete vrednost, ki jo želite primerjati.


Če izberete opcijo, kjer določite želeno vprašanje (zavihek 'Prejšnje vprašanje') in če to vprašanje uporablja vnaprej določene odgovore, potem so te vrednosti vidne v zavihku ''Prednastavljeno''.
<div class='simplebox'> [[File:help.png]] '''Help:''' For more information on relevance equations, check the [[Expression Manager]] and [[QS:Relevance|relevance equation]] wiki sections. </div>


===Izbira primerjalnega operatorja===
=How to copy conditions=




<center>[[File:comparison_operators_conditions.png]]</center>
The copy conditions functionality can be used when you wish to apply the same set of conditions you applied to Question5 to Question10. In this way, you will not have to manually recreate the conditions you applied to the previous question(s).


To start copying conditions, you first have to select the question the condition(s) is/are applied to (Question 'LowQ' in our case). Then, select the conditions you wish to be copied and select the question you wish to have the conditions added to (Question 'Alcohol' in our case).


Na voljo so naslednji primerjalni operatorji:
* ''Je enako'' oziroma ''ni enako'' (osnovni operator)
* Večje ali manjše, ki se ponavadi uporablja, če vprašanje od nas zahteva odgovor v obliki številčnega vnosa
** Upoštevajte, da se pri tem spoštujejo pravilo zaporedja števil (primer: 2<10)
** Pri uporabi tipa vprašanja, ki omogoča vnos teksta, se lahko pogoj vrednoti v obliki "2" > "10" (pravilo zaporedja niza)
** Tako vprašanja, ki omogočajo številčni odgovor kot tista, ki omogočajo tekstovni odgovor in imajo atribut nastavljen na 'le številke', pri primerjanju uporabljajo pravilo zaporedja števil
* Na voljo je tudi napredni primerjalni operator, ki uporablja regularne izraze. Ko je izbran, se polje za vnos odgovora samodejno preklopilo v napredni način.


===Izbira ''primerjalne vrednosti''===
<center>[[File:Copy conditions panel.png]]</center>


Izberite zavihek, ki ustreza tipu želene ''primerjalne vrednosti''. Izbirate lahko med:
* Prednastavljeno
* Konstanta
* Odgovor na prejšnje vprašanje
* Polja žetona
* Regularni izraz


Nato vnesite ali izberite vrednost, ki jo želite uporabiti.
<div class='simplebox'>[[FIle:help.png]] '''Note:''' Conditions can only be set based on questions that appear before the question on which the condition is set.</div>


Upoštevajte, da če izberete vrednost v poljubnem zavihku in nato spremenite izbrano vrednost z vrednostjo v drugem zavihku, se prva izbira izniči.
Please pay attention to how the copy conditions functions work when you wish to copy and apply a set of conditions located under different scenarios to another question which uses the same or different scenario id numbers. To summarise the possible cases you might have, check the following example:


Pri uporabi ''vnaprej določenega odgovora'' lahko izberete enega ali več vnaprej določenih odgovorov:
* you wish to copy Scenario 1 - Condition A, Scenario 1- Condition B, Scenario 7 - Condition C, and Scenario 7 - Condition D from QuestionX into QuestionY
* možni odgovori za to vprašanje
*QuestionY already contains Scenario 1 - Condition A, Scenario - Condition C, Scenario 6 - Condition E, Scenario 8- Condition F.
** Izberite želen odgovor, ki ga želite uporabiti
*Once copied, the following conditions will be applied to QuestionY:
** Hkrati lahko izberete več odgovorov naenkrat s uporabo CTRL gumba (držite CTRL in nato klikate na želene odgovore v desnem izbirnem seznamu)
**Scenario 1: Condition A, Condition B, Condition C -> '''Condition A is not copied anymore as it already exists in QuestionY, only condition B being copied.'''
**Scenario 6: Condition E -> not affected
**Scenario 7: Condition C, Condition D -> '''a new scenario is created where the two conditions are added to it'''
**Scenario 8: Condition F -> not affected


Nato kliknete na gumb "Dodaj pogoj".
=Stvari, na katere morate biti pozorni=


==Urejanje/brisanje pogojev==
Opcija 'Dodaj/uredi' se poleg dodajanja novega pogoja uporablja tudi za:
* urejanje pogojev
* brisanje pogojev
* urejanje scenarija
===Urejanje pogojev===
S klikom na ikono za urejanje [[File:conditions_edit.png]], ki se nahaja v vrstici pogoja, se na dnu samodejno pojavi urejevalnik pogoja s prvotnimi nastavitvami, ki smo jih opredelili za ta pogoj. Upoštevajte, da v tem načinu lahko izberete samo en vnaprej določen odgovor.
Kliknite na gumb za posodobitev pogoj za posodobitev tega pogoja.
===Izbriši pogoje===
Na voljo imate:
* Izbrišite posamezen pogoj [[File:conditions_delete.png]]
* Izbrišite vse pogoje znotraj scenarija [[File:scenario_delete.png]]
* Izbrišite vse pogoje iz tega vprašanja  [[File:conditions_deleteall.png]]
===Uredi scenarij===
Številko dodeljeno scenariju lahko spremenite s klikom na ikono [[File:scenario_edit.png]]. Nato morate izpolniti obrazec, ki se pojavi v isti vrstici.
[[File:edit_scenario_conditions.png]]
Številko scenarija lahko spremenite tudi s klikom na naslednjo ikono [[File:scenario_renumber.png]].
Kot smo že omenili, številke scenarijev nimajo nobenega vpliva kako pogoje vrednotimo. Vendar pa je sprememba številke scenarija pomembna, ko želimo:
* določiti v kakšnem vrstnem redu želimo, da se scenariji prikazujejo v tiskani verziji anketnega vprašalnika
* združiti pogoje dveh scenarijev (v primeru združevanja scenarija 10 s scenarijem 1 le preštevilčite scenarij 10 z ID številko prvega scenarija).
==Kopiranje pogojev za kasnejša vprašanja==
Za skupino vprašanj ni neobičajno, da imajo iste pogoje. Na srečo lahko te pogoje kopiramo in jih v načrtovanju pogojev prenesemo na kasnejša vprašanja, ko je enkrat prvi pogoj določen.
Preklopite v način kopiranja s klikom na ikono Kopiraj pogoje [[File:conditions_copy.png]].
[[File:copy_conditions_example.png]]
Pogoji, ki se nanašajo na trenutna vprašanja, so prikazani v okencu na njihovi levi. Pri tem lahko:
* izberemo posamezen pogoj s klikom na polje levo od pogoja
* ali izberemo vse pogoje scenarija hkrati s klikom na polje levo od scenarija
Nato v naslednjem okencu 'Prekopiraj izbrane pogoje k: ' izberemo vsa nadaljnja vprašanja v anketi, ki jim želimo kopirati izbrane pogoje (s CTRL lahko določimo več vprašanj hkrati). Za konec kliknemo na ''Kopiraj pogoje''.
Običajno se to izvaja, ko smo vnesli vsa želena vprašanja v anketo in smo zadovoljni z njenim zaporedjem.
=Stvari, na katere morate biti pozorni=


==Splošni premisleki==
==Splošni premisleki==
Line 446: Line 478:
* Če v anketi spremenimo vrstni red vprašanj, LimeSurvey v primeru prekinitve že nastavljenih pogojev ne prikaže posebnega opozorila. Zato priporočamo, da pogojev ne določate dokler niste povsem zadovoljni z vrstnim redom vprašanj in skupin v vaši anketi  
* Če v anketi spremenimo vrstni red vprašanj, LimeSurvey v primeru prekinitve že nastavljenih pogojev ne prikaže posebnega opozorila. Zato priporočamo, da pogojev ne določate dokler niste povsem zadovoljni z vrstnim redom vprašanj in skupin v vaši anketi  
* Spreminjanje pogojev je omogočeno tudi, ko je anketa že aktivirana vendar je to potrebno narediti previdno, saj ni ''doslednosti preverjanja''
* Spreminjanje pogojev je omogočeno tudi, ko je anketa že aktivirana vendar je to potrebno narediti previdno, saj ni ''doslednosti preverjanja''


==Pogoji, ki uporabljajo prednastavljene odgovore oblike 'brez odgovora'==
==Pogoji, ki uporabljajo prednastavljene odgovore oblike 'brez odgovora'==
Line 452: Line 485:
<center>[[File:noanswer_conditions.png]]</center>
<center>[[File:noanswer_conditions.png]]</center>


Nastavitev naslednjega pogoja "Prikaži vprašanje Q20 v primeru, če je odgovor na vprašanje Q1 enak 'brez odgovora'" dejansko pomeni "prikaži vprašanje Q20, če je bilo vprašanje Q1 prikazano in sprejelo ni odgovora". To ni identično "prikaži vprašanje Q20, če vprašanje Q1 ni bilo prikazano"
 
Setting the following condition "Show question 'FavColour' if the answer to the question 'Gender' is 'no answer'" really means "show question 'FavColour' if question 'Gender' was displayed to the survey participant who did not submit answer".
 
 
{{Hint|Text=To have the no answer option displayed as a predefined answer, the question cannot be [[QS:Mandatory|mandatory]].}}
 


==Verižno pogojevanje==
==Verižno pogojevanje==


Če določamo pogoj vprašanju, ki že sam po sebi vsebuje pogoj, potem lahko pride tudi do situacije, ki je nismo predvidevali. Na primer: tipičen nepredviden učinek je, če skrijete vsa vprašanja v skupini z verižnim pogojevanjem, se glava skupine kljub vsemu prikaže razen če postopamo kot je razloženo v nadaljevanju.
 
If you set conditions on a question that, itself, has conditions, you could end up with your survey behaving in ways you might not have predicted. For example, a typical side-effect is that if you hide all questions in a group with chained conditions, the group header will still be shown unless you correct these conditions as explained below.




Line 465: Line 504:




V zgornjem primeru se prikaže vprašanje 'Ali vam je všeč biti moški?' in je določen s pogojem. Prikaže se le v primeru, če je odgovor na vprašanje "Spol" enak "M". Če bi temu vprašanju dodali pogoj, ki bi zahteval točno določen odgovor na ''Ali vam je všeč biti moški'', potem se to vprašanje ne bi nikoli prikazalo, saj vprašanje ''Ali vam je všeč biti moški'' sploh ne bi bilo predstavljeno.
In the above example, the 'Alcohol' question is displayed if the respondent has previously answered to the 'AAMN' question 'No (N)'. However, the 'AAMN' question might not be displayed at the end if the respondent did not select to the previous question ('Gender') answer 'Male (M)'. In this scenario, no 'Alcohol' question will be displayed if 'Male (M)' was chosen previously.


Zelo je priporočljivo kopiranje pogojev iz prejšnjega vprašanja v to, ki ga urejate.
To have the 'Alcohol' question displayed, you have to copy the conditions from the earlier question(s) to the one you're editing. To have the 'Alcohol' question displayed, you need to set up the following set of conditions:
 
* Show 'AAMN' if the answer to 'Gender' is 'Male (M)'
Na primer, da želite sledeče:
* Show 'Alcohol' if answer to 'Gender' is 'Male (M)' '''and''' if answer to 'AAMN' is No (N)'.
* Q1 je vprašanje o spolu
* Q2 vsebuje dve možnosti: Da/Ne in se prikaže, če je odgovor na Q1 enak moški
* Q3 je razvrstitveno vprašanje in se prikaže v primeru, če je Q2 enak Da
 
What you really need to setup is the following set of conditions:
* on Q2: display question if answer to Q1 is Male
* on Q3: display question if answer to Q1 is Male AND answer to Q2 is Yes


Po popravku bi pravilen nabor pogojev za Q3 izgledal sledeče:
Po popravku bi pravilen nabor pogojev za Q3 izgledal sledeče:
Line 484: Line 516:




Torej, če načrtujete kompleksno anketo z velikim številom pogojev, poskrbite, da boste testirali anketo za vse možne situacije, ki si jih lahko zamislite.
So if you are designing a complicated survey with a large number of conditions, make sure you test the survey for as many different combinations of results as you can think of.
 
<div class='simplebox'>[[File:help.png]] To find out more on how you can copy conditions in LimeSurvey, please scroll up or click here to continue reading the dedicates [[Setting_conditions#How_to_copy_conditions|wiki section]].</div>




==Omejitve in bližnjice==
==Omejitve in bližnjice==


===Prikaz napredka===
===Prikaz napredka===


Če anketa vsebuje večje število vprašanj, ki so bila izpuščena zaradi pogojev, se bo prikaz napredka hitreje pomikal, na koncu pa lahko anketa prikazuje, da smo odgovorili le na polovico vprašanj.


Da bi se izognili takšni situaciji, je potrebno vprašanja, ki se lahko preskočijo, razporediti med preostala vprašanja, tako da se preskoči le eno ali dve vprašanji na odgovor.
If you create a survey where many questions get skipped because of conditions, the progress bar either jumps over a set of questions or the survey ends at 50%.


For Example: based on question one (yes or no question) 14 questions will be asked question 2A to 15A when the answer of question one was yes, 2B to 15B when the answer to question one was no.
To avoid such behavior, the questions that could be skipped should be arranged between the shown questions. In this way, only one or two questions get skipped per answer.


Če uredite vprašanja v eno skupino in jih razporedite na naslednji način: 2A, 2B, 3A, 3B... boste dobili skoraj pravilen prikaz napredka. Če pa je ta ureditev oblike 2A, 3A, 4A ... 2B, 3B, 4B ... bo prikaz napredka med 0 in 50% ali med 50% in 100% (odvisno od odgovora na prvo vprašanje).
For example, based on Question1 (yes or no question), 14 questions (2A to 15A) will be displayed if the answer to Question1 is 'Yes', or 2B to 15B if the answer to Question1 was 'No'.
 
If you arrange the questions in one group and arrange them like 2A, 2B, 3A, 3B, and so on, you will get a nearly correct progress bar, while arranging the questions like 2A, 3A, 4A, [...], 2B, 3B, 4B, ... you will get a progress bar from 0 to 50% or from 50% to 100%, depending on the answer to the first question.




===Nastavitev konstante pri vprašanju tipa ''Datum''===
===Nastavitev konstante pri vprašanju tipa ''Datum''===


Uporabiti boste morali interni prikaz vrednosti Datuma, ki je  YYYY-MM-DD, da boste lahko opredelili konstanto.
Uporabiti boste morali interni prikaz vrednosti Datuma, ki je  YYYY-MM-DD, da boste lahko opredelili konstanto.
Line 507: Line 544:
=== Nastavitev pogojev pri izbiri možnosti "Drugo" v primeru vprašanja tipa Vprašanja z več izbirami===
=== Nastavitev pogojev pri izbiri možnosti "Drugo" v primeru vprašanja tipa Vprašanja z več izbirami===


Pri vprašanju tipa Vprašanja z več izbirami, je ena izmed možnost tudi, da obkljukate ''Drugo'' kot veljavno izbiro vendar v tem primeru pri tem vprašanju ne morete določiti pogoja. Na primer: Prvo vprašanje se glasi ''Katero barvo raje uporabljate?''. Odgovori so sledeči: modra, črna ali drugo. Če anketiranec odgovori modra, pogoj lahko določimo. Če je odgovor črna, tudi lahko določimo pogoj. Vendar, če anketiranec odgovori ''Drugo'' in v polje vpiše poljuben tekst, pogoja enostavno ni mogoče določiti. To NI napaka ampak omejitev LimeSurvey-a.
 
In the multiple options question type, you can use the "Other" provided in the question type as a valid choice but you cannot set conditions on it. For example, Question No 1 says "Which color do you prefer to use?" Answer checkbox choices are Blue, Black and Other. If the participant chooses Blue, you can set a condition. If the participant chooses Black, you can set a different condition. '''However, if the participant chooses "Other" and types in something in the text box, there is NO way a condition can be set.''' LimeSurvey does not recognize if the participant chose the "Other" condition. This is NOT a bug but a limitation.


V primeru, da anketiranec izbere odgovor 'Drugo', le to nikjer ni razvidno oziroma posebej zabeleženo. Edini način, da preverimo ali je anketiranec izbral to možnost ali ne je, da preverimo ali je bil vnesen tekst v polje za komentar.
V primeru, da anketiranec izbere odgovor 'Drugo', le to nikjer ni razvidno oziroma posebej zabeleženo. Edini način, da preverimo ali je anketiranec izbral to možnost ali ne je, da preverimo ali je bil vnesen tekst v polje za komentar.
Line 517: Line 555:


===Kako uporabljati oklepaje pri matematičnih izrazih?===
===Kako uporabljati oklepaje pri matematičnih izrazih?===


'''''Ne morete!'''''
'''''Ne morete!'''''

Revision as of 15:00, 9 August 2018


Pregled pogojev v LimeSurvey-u

LimeSurvey has a very powerful logical branching feature. It can be accessed by clicking on the Set conditions button - - located on each question bar.

In this chapter we will describe:

  • what conditions you can find in LimeSurvey
  • what you can and can't do with conditions
  • what steps you need to learn to set up simple or more complex conditions

For step-by-step video instructions check out this tutorial or download the condition sample survey: LimeSurvey_Survey_Setting_Conditions.zip.


 Hint: The conditions functionalities work like a GUI for the expressions and equations that can be applied to questions, allowing the users to easily increase the complexity of their surveys without getting into expressions and relevance equations. However, the Expression Manager must be studied/known to increase the range of options that is available within LimeSurvey.


Hide/Show Branching Versus Jump Branching

LimeSurvey vam omogoča izdelati logiko razvejanosti. Določite lahko, da bodo nekatera vprašanja prikazana le, če so izpolnjeni nekateri pogoji (primer: Prikaži vprašanje X, če je vprašanje Y bilo odgovorjeno z možnostjo Z).

Ideja je, da izvedemo "Prikaži/Skrij razvejanost podvprašanj":

  • Pri vsakem vprašanju v anketi lahko definirate pogoj ali niz pogojev: vprašanje se prikaže, če je pogoj izpolnjen



Simply put:
  • a question without a condition defined on it will always be displayed;
  • a question with a condition defined on it will not be displayed unless the condition is met.

This approach is different from the Jump Branching Logic that is sometimes implemented by other software. In the Jump Branching Logic, the resulting action of a met condition would be to jump to another question (that is to say hide all questions in between). LimeSurvey doesn't implement this Jump Branching Logic method. Instead, if you wish to jump a series of questions, you should simply set the same condition on all the questions you do not wish to be displayed. For example, if the jump condition you want to set on Question2 is "Jump to Question5 if the answer to Question1 is 'Yes'", you can simply:

  • set a condition on questions 2, 3 and 4 to only display "if the answer to Question1 was NOT 'Yes'"

LimeSurvey makes setting the same condition on multiple questions (and thus implementing Jump Branching Logic) easy by allowing you to "copy" a condition from one question to a series of others. In the above example, you would begin by setting the condition on Question2, then from the same screen, you would copy that condition to Question3 and Question4.

To find out more details on how you can copy conditions within LimeSurvey, please continue reading the following wiki section.


Veljavni tipi pogojev

Basically, a condition can compare values, returning either true or false.

The values that can be compared are answers to previous questions. For instance, if you answer 'Yes' to Question1, Question2 will then be showed to the survey respondent:





Na tej točki je zelo pomembno, da razumemo katero vstopno vprašanje je primerno za urejevalnik pogojev:

A question-entry is either:

  • a simple question (for all question types apart from Array questions)
    • for instance: text questions, radio or dropdown lists, and even multiple choices questions
  • or a row in Array questions (except for Array dual scale and Array multiple flexible questions)
    • for instance: array with 5 radio buttons or array with label questions
  • or either the left part or the right part of an Array dual scale question
  • or each cell of an Array flexible question
Check the following link to find out more about the available question types in LimeSurvey.
  • constant values
    • for instance: "If you answered more than 18 years to the question below"



  • Participants' profile data: To use data from the survey participants table, "Anonymized responses" must be set to NO.  This option can be found in survey participant settings panel.





Several comparison operators are supported - from the simple "equals" to the advanced "regular expression":

  • The basic ones refer to the "equal" and "not equal to" operations
  • The greater/less than operator family is also available, and is usually used when using numeric question-entries
    • Please note that comparisons on numeric fields make use of the numeric order. For instance, 2 < 10
    • If you're using a question entry whose type is text, the condition could be evaluated as "2" > "10" (string order)!
    • Numeric questions, as well as text questions (when they have the 'numbers_only' attribute set), will use the numeric order for comparisons
  • An advanced comparison operator using regular expressions is also available (don't panic! If you don't know what this means, then you don't need it)
    • the pattern is not to be enclosed in '/' characters
    • for instance: [a-zA-Z]$


Kako lahko združimo pogoje

Sestavimo lahko kompleksne pogoje s kombinacijo preprostih pogojev z logičnimi operatorji IN in ALI.



Zavedati se moramo, da LimeSurvey avtomatično določi kateri logični operator uporabiti: to pomeni, da se uporaba operatorja IN ali ALI določi glede na kontekst pogoja.

We'll talk more about complex conditions later. Let's first focus together on the elementary ones.


Dostop do urejevalnika

First, you need to access the conditions designer. To do that, click on the question you wish to apply the condition to:



Now, look for the Set conditions button located on the top question bar:



Once accessed, the following page will be displayed:



The conditions designer panel can be divided into three sections:


The conditions designer toolbar

You may find on the toolbar the following options:



  • Show conditions for this question: Click on this button to get a quick overview of the current existent conditions that are applied to your question.
  • Add and edit conditions: It represents the default page that opens automatically once you click the Set conditions button. It is divided in two parts: (1) a table displaying all the existent conditions and scenarios, and (2) the add/edit conditions menu.
  • Copy conditions: Sometimes, you wish to apply the same condition to X questions in order to get questionY displayed at the end. For this, click on Copy conditions. A new window will open displaying the current existent conditions added to your question (let's call it question3). To add them to question5, check the desired conditions you wish to be copied, select question5, and click on the Copy conditions button located on the bottom left part of the panel. For further information, please continue reading the following wiki section.
  • Save and close: Once you are done with the changes, click Save and close to get your conditions saved.
  • Move to question: In order not to leave the conditions designer panel while moving to another question, use the following option to select from the dropdown list the next question you wish to apply conditions to. Please note that the dropdown list displays the questions that are displayed in the survey before and after the current question.
  • Close: If you wish to exit the panel without performing any changes, you can either go straight to the settings/structure tab and select the desired option or click Close, which is located in the upper right of the screen.


Overview of the existent conditions

This section displays a table that contains all the existent scenarios and conditions of a question. Certain actions can be performed from here:



  • In the top right part, three actions are available:
    • Quick-add conditions - it fastens the process of adding conditions (read below to learn about all the options)
    • Renumber scenarios - if clicked, the scenarios will be renumbered with incremental numbers beginning from one. Please note that this option is displayed only if two or more scenarios are applied to your question.
    • Delete all conditions - you can delete via this action all the current existent conditions and scenarios applied to your question.



  • Besides the id number of each scenario there are three buttons that allow you to perform the following actions:
    • Delete scenario
    • Change scenario number
    • Add condition to this scenario - click on this button to add another condition to the desired scenario



  • Two actions can be performed on each condition:
    • Delete condition
    • Edit condition - if clicked, you will be able to edit the condition from the conditions menu


Add/Edit conditions

The bottom part of the screen is allocated to the Add/edit conditions menu:



You can also edit the condition from the same location if you pressed before on the green pencil that corresponds to the question you wish to be edited (see the conditions and scenarios table).

To understand how the conditions feature works in LimeSurvey, we will first present the elementary conditions.


Opomba: v tem trenutko ne spreminjajmo privzetega scenarija (), ki je samodejno izbran v tem pogojnem obrazcu; več o tem kasneje.


Opredelitev osnovnih elementov

Osnovni pogoj je edini pogoj brez dodatnih logičnih operaterjev IN ali ALI.

Sestavljajo ga:

  • levi operand: vrednost, ki jo preverjamo
    • vrednost, ki jo preverjamo, označimo tako, da izberemo ustrezen jeziček v urejevalniku pogoja



If you select a question-entry (from the Previous questions tab) and if this question uses predefined answers, then the corresponding predefined answers are displayed under the Predefined tab of the comparison value selection.


Note that in order to use the Token your survey must:


  • a comparison operator. Choose the comparison operator you want to apply from the dropdown list (less than, less than or equal to, equals, not equal to, greater than or equal to, greater than, regular expression).


  • a right operand: the comparison value. You can choose the comparison value type by selecting the appropriate tab in the condition editor. When you create a condition, you can select as the comparison value a predefined value (answer), a constant, a question, a survey participant attribute, or a regular expression:


Example of elementary conditions and how to create them

Primer osnovnih pogojev in kako jih ustvariti

  • Prikaži vprašanje v primeru, ČE "je bil odgovor na vprašanje1 v naprej določen odgovor 'Moški'"
    • preizkušena vrednost = odgovor na vprašanje1
    • primerjalni operator = je enako
    • primerjalna vrednost = vrednost primerjamo z odgovorom 'Moški"



  • Show Question 'Alcohol' if "the answer to Question 'Age' is greater or equal than the numerical value '18'"
    • tested value = answer to Question 'Age'
    • comparison operator = greater than or equal to
    • comparison value = the constant value '18'



  Attention : When using a constant 'comparison value' for a date question, regardless of the date format set in your survey, you must use the YYYY-MM-DD date format.



  • Show Question 'Alcohol' if "the answer to Question 'BirthDate' is greater than 2000-01-01"
    • tested value = answer to Question 'BirthDate'
    • comparison operator = Greater than or equal to
    • comparison value = '2000-01-01' (the format in the constant field: 2000-01-01)



  • Show Question 'Alcohol' if "the the 'DrinkingHistory' participant's attribute" matches the 'Yes' string.
    • tested value= the 'DrinkingHistory' value taken from the survey participants table
    • comparison operator = equals
    • comparison value = the constant value 'Yes'


Conditions and scenarios in LimeSurvey

Privzete kombinacije pogoja

Kot smo že povedali, LimeSurvey samodejno določi kateri logični operator (IN/ALI) bo izbran med pogoji, kar je odvisno od samega 'konteksta'.

Upoštevajte tudi, da vrstni red, po katerem smo definirali osnovne pogoje, ni pomemben. LimeSurvey jih bo samodejno preuredil po lastni presoji.

Poglejmo si to podrobneje.


Prvo pravilo: pogoji z isto preizkušeno vrednostjo so med seboj povezani z ALI

When you have several conditions, they are ORed together if they share the same tested value. This is the case if the condition applies to several answers belonging to one single question. For example, a condition was applied below to three answers belonging to the same question - if answer to Question 'FavColour' equals 'green' OR  answer to Question 'FavColour' equals 'red'  OR  answer to Question 'FavColour' equals 'blue', then Question 'BirthDate' will be displayed to the survey respondent:



Note: To select multiple predefined answers, don't forget to hold the Shift or Ctrl key while selecting the tested values.


Drugo pravilo: pogoji z isto preizkušeno vrednostjo so med seboj povezani z IN

When you have several conditions, they are ANDed together if they don't share the same tested values. For example, you may see below the case for several conditions based on different previous questions - "If answer to Question 'Alcohol' equals 'Y' answer AND answer to Question 'Gender' equals 'F'", then Question 'Alcoholconsumption' will be displayed to the survey respondent:



Vprašanja z več izbirami

Opomba: Ta odstavek se nanaša na vprašanja tipa Več možnosti in Več možnosti s komentarjem in ne na Polja (številke) (pri tem tipu vprašanj je vsako potrditveno polje definirano kot posamezen vnos in se s tem ne obravnava kot preostala vprašanja z več izbirami).


V urejevalniku pogojev se vprašanja tipa Več možnosti in Več možnosti s komentarjem prikažejo na dva različna načina:

  • Prvi način - Skupina potrditvenih polj: vam omogoča določitev pogojev za vse možne odgovore tega vprašanja
  • Drugi način - Nova možnost odgovora: vam omogoča določite pogojev za vsak odgovor posebej



The group of checkboxes flavour

Now, let's focus on an example to better understand the difference between the two flavours. Let's imagine that we wish to display the 'Pointchoice' Question only if the respondent checks at least one of the tested answers listed under the 'MultipleOrganizations' Question.

As mentioned above, the group of checkboxes flavor allows you to set conditions on all possible answers of the respective question. Therefore, only the options that refer to responsibilities are selected as comparison values below:



As we can observe, the conditions get ORed due to the Group of checkboxes flavour selected in the beginning.:



ANDing conditions in multiple choice questions

Now, let's focus on a similar example. However, we are looking this time only for the most active members to ask them further questions. To do this, we make use of the Single checkbox flavour which allows you to set conditions based on each checkbox individually.

In this example, question X will be displayed if A and B are checked:



Once done, you can observe that the two conditions are ANDed now.



This means that your question will not be displayed unless both tested values (the selected subquestions) are met.


Primer uporabe pogojev ALI med različnimi vprašanji

Now, you may argue that sometimes you need to have ORed conditions even when they are set on different questions (that is to say on different tested values). This is why we got scenarios!


Opredelitev scenarija

Scenarij je ročno ustvarjena skupina pogojev' v katerem so pogoji neodvisno ovrednoteni od pogojev iz drugih scenarijev. Zapleteno stanje, ki izhaja iz prepletanja več scenarijev bo izpolnjeno, če bo izpolnjen le en scenarij. Z drugimi besedami: scenariji so logična skupina pogojev, ki z upoštevanjem zgoraj navedenih pravil in medsebojne ALI povezave predstavljajo zapletene okoliščine.

Celoten zgornji opis velja znotraj posameznega scenarija. Pri tem tudi velja, da so vsi novi pogoji ustvarjeni znotraj "Prvotnega scenarija".


Dodajanje vprašanja v dodaten scenarij

Ko ustvarite (ali urejate) pogoj, lahko spremenite scenarij v katerem je shranjen pogoj:



Če morate določiti pogoj v drugem scenariju kot prvotnem, kliknite na ikono Dodaj scenarij File:Plus.png in vnesite številko scenarija: File:Default scenario edit.png

ID številka scenarija nima večjega pomena zato lahko imajo različni scenariji naključno izbrane ID številke.



Številko dodeljeno scenariju lahko spremenite s klikom na ikono . Nato morate izpolniti obrazec, ki se pojavi v isti vrstici.



Kot smo že omenili, številke scenarijev nimajo nobenega vpliva kako pogoje vrednotimo. Vendar pa je sprememba številke scenarija pomembna, ko želimo:

  • določiti v kakšnem vrstnem redu želimo, da se scenariji prikazujejo v tiskani verziji anketnega vprašalnika
  • združiti pogoje dveh scenarijev (v primeru združevanja scenarija 10 s scenarijem 1 le preštevilčite scenarij 10 z ID številko prvega scenarija).


Example: creating three scenarios

To create three scenarios, you need at least three conditions and to add to each of them a different scenario id. Once done, the scenarios are going to be connected among themselves via the 'OR' operator. For example, it could look like this:


AND vs OR in the same scenario

You may end up in certain cases with AND and OR logical operators in the same scenario:



LimeSurvey will always apply first OR. For further details on this, you may check the following Wikipedia article on Boolean algebra.

However. the order of operations can also be observed in the Relevance equation field. For the above example, the relevance equation is highlighted below:



As it can be observed, a set of extra parentheses is added for the OR logical operations in order to let the software know that it must be "computed" first.


Help: For more information on relevance equations, check the Expression Manager and relevance equation wiki sections.

How to copy conditions

The copy conditions functionality can be used when you wish to apply the same set of conditions you applied to Question5 to Question10. In this way, you will not have to manually recreate the conditions you applied to the previous question(s).

To start copying conditions, you first have to select the question the condition(s) is/are applied to (Question 'LowQ' in our case). Then, select the conditions you wish to be copied and select the question you wish to have the conditions added to (Question 'Alcohol' in our case).



Note: Conditions can only be set based on questions that appear before the question on which the condition is set.

Please pay attention to how the copy conditions functions work when you wish to copy and apply a set of conditions located under different scenarios to another question which uses the same or different scenario id numbers. To summarise the possible cases you might have, check the following example:

  • you wish to copy Scenario 1 - Condition A, Scenario 1- Condition B, Scenario 7 - Condition C, and Scenario 7 - Condition D from QuestionX into QuestionY
  • QuestionY already contains Scenario 1 - Condition A, Scenario - Condition C, Scenario 6 - Condition E, Scenario 8- Condition F.
  • Once copied, the following conditions will be applied to QuestionY:
    • Scenario 1: Condition A, Condition B, Condition C -> Condition A is not copied anymore as it already exists in QuestionY, only condition B being copied.
    • Scenario 6: Condition E -> not affected
    • Scenario 7: Condition C, Condition D -> a new scenario is created where the two conditions are added to it
    • Scenario 8: Condition F -> not affected

Stvari, na katere morate biti pozorni

Splošni premisleki

Obstaja nekaj osnovnih pravil na katere morate paziti preden določite pogoje v zvezi z vprašanjem:

  • Ko enkrat določimo pogoj za določeno vprašanje, se to vprašanje ne bo prikazalo razen če bo pogoj izpolnjen
  • Pogoje je možno nastaviti le na osnovi vprašanj, ki se pojavijo pred vprašanjem na katerem nastavljamo pogoj
  • Če v anketi spremenimo vrstni red vprašanj, LimeSurvey v primeru prekinitve že nastavljenih pogojev ne prikaže posebnega opozorila. Zato priporočamo, da pogojev ne določate dokler niste povsem zadovoljni z vrstnim redom vprašanj in skupin v vaši anketi
  • Spreminjanje pogojev je omogočeno tudi, ko je anketa že aktivirana vendar je to potrebno narediti previdno, saj ni doslednosti preverjanja


Pogoji, ki uporabljajo prednastavljene odgovore oblike 'brez odgovora'


Setting the following condition "Show question 'FavColour' if the answer to the question 'Gender' is 'no answer'" really means "show question 'FavColour' if question 'Gender' was displayed to the survey participant who did not submit answer".


 Hint: To have the no answer option displayed as a predefined answer, the question cannot be mandatory.


Verižno pogojevanje

If you set conditions on a question that, itself, has conditions, you could end up with your survey behaving in ways you might not have predicted. For example, a typical side-effect is that if you hide all questions in a group with chained conditions, the group header will still be shown unless you correct these conditions as explained below.




In the above example, the 'Alcohol' question is displayed if the respondent has previously answered to the 'AAMN' question 'No (N)'. However, the 'AAMN' question might not be displayed at the end if the respondent did not select to the previous question ('Gender') answer 'Male (M)'. In this scenario, no 'Alcohol' question will be displayed if 'Male (M)' was chosen previously.

To have the 'Alcohol' question displayed, you have to copy the conditions from the earlier question(s) to the one you're editing. To have the 'Alcohol' question displayed, you need to set up the following set of conditions:

  • Show 'AAMN' if the answer to 'Gender' is 'Male (M)'
  • Show 'Alcohol' if answer to 'Gender' is 'Male (M)' and if answer to 'AAMN' is No (N)'.

Po popravku bi pravilen nabor pogojev za Q3 izgledal sledeče:



So if you are designing a complicated survey with a large number of conditions, make sure you test the survey for as many different combinations of results as you can think of.

To find out more on how you can copy conditions in LimeSurvey, please scroll up or click here to continue reading the dedicates wiki section.


Omejitve in bližnjice

Prikaz napredka

If you create a survey where many questions get skipped because of conditions, the progress bar either jumps over a set of questions or the survey ends at 50%.

To avoid such behavior, the questions that could be skipped should be arranged between the shown questions. In this way, only one or two questions get skipped per answer.

For example, based on Question1 (yes or no question), 14 questions (2A to 15A) will be displayed if the answer to Question1 is 'Yes', or 2B to 15B if the answer to Question1 was 'No'.

If you arrange the questions in one group and arrange them like 2A, 2B, 3A, 3B, and so on, you will get a nearly correct progress bar, while arranging the questions like 2A, 3A, 4A, [...], 2B, 3B, 4B, ... you will get a progress bar from 0 to 50% or from 50% to 100%, depending on the answer to the first question.


Nastavitev konstante pri vprašanju tipa Datum

Uporabiti boste morali interni prikaz vrednosti Datuma, ki je YYYY-MM-DD, da boste lahko opredelili konstanto.


Nastavitev pogojev pri izbiri možnosti "Drugo" v primeru vprašanja tipa Vprašanja z več izbirami

In the multiple options question type, you can use the "Other" provided in the question type as a valid choice but you cannot set conditions on it. For example, Question No 1 says "Which color do you prefer to use?" Answer checkbox choices are Blue, Black and Other. If the participant chooses Blue, you can set a condition. If the participant chooses Black, you can set a different condition. However, if the participant chooses "Other" and types in something in the text box, there is NO way a condition can be set. LimeSurvey does not recognize if the participant chose the "Other" condition. This is NOT a bug but a limitation.

V primeru, da anketiranec izbere odgovor 'Drugo', le to nikjer ni razvidno oziroma posebej zabeleženo. Edini način, da preverimo ali je anketiranec izbral to možnost ali ne je, da preverimo ali je bil vnesen tekst v polje za komentar.

Vendar pa zaradi specifičnega načina obravnave Vprašanja z več izbirami testiranje besedilnega polja pri možnosti 'Drugo' nikoli ni bilo izvršeno.

Vendar lahko zgoraj opisano težavo zaobidemo in sicer tako, da dodamo ekspliciten odgovor, ki ga poimenujemo 'Drugo' in ne že v naprej nastavljeno možnost 'Drugo'. Nato dodamo dodatno polje za vprašanje tipa Kratko besedilo, ki se bo prikazalo v primeru, če je bil izbran odgovor 'Drugo'.


Kako uporabljati oklepaje pri matematičnih izrazih?

Ne morete!

Če želite ustvariti naslednji izraz:

 (pogoj1 ALI pogoj2) IN (pogoj3 ALI pogoj4)

morate narediti sledeče:

(pogoj1 IN pogoj3) ALI

(pogoj1 IN pogoj4) ALI

(pogoj2 IN pogoj3) ALI

(pogoj2 IN pogoj4)