Actions

Check survey logic - Advanced/nl: Difference between revisions

From LimeSurvey Manual

(Created page with "=Voorbeelden=")
(Created page with "De volgende voorbeelden komen uit de ExpressieScript voorbeeld enquêtes.  Er staan schermafdrukken van enquêtes die uitgevoerd worden...")
Line 123: Line 123:




The following examples are taken from the [[ExpressionScript sample surveys|ExpressionScript sample surveys]]. You can find screenshots of running surveys, explanations, and downloads on that page.
De volgende voorbeelden komen uit de [[ExpressionScript sample surveys/nl|ExpressieScript voorbeeld enquêtes]].  Er staan schermafdrukken van enquêtes die uitgevoerd worden, uitleg en mogelijke downloads.





Revision as of 21:37, 21 January 2021


Algemeen

Een belangrijke optie die je helpt bij het maken en onderhouden van een complexe enquête is Enquête logica-bestand.

Tijdens het maken en het testen van de enquête is het belangrijk om de logica van de enquête te valideren voordat je de enquête activeert. Dit geldt met name als er complexe relevantie, maatwerk en validatie-vergelijkingen gebruikt worden, anders kan de enquête mogelijk niet goed ingevuld worden.

Met deze functie kun je snel controleren of de enquête, groep of vraag goed is ingevoerd. Selecteer eerst een enquête, kies daarna de functie in de instellingen van de enquête op het menu Hulpmiddelen;



Hierboven zie je dat de optie voor elke taal die in een enquête wordt gebruikt, kan worden uitgevoerd.

Beschrijving

Deze functie toont alles wat gespecificeerd is voor elke vraag (bijvoorbeeld: naam, tekst, help, condities/relevantie, validatie-regels, standaarden, subvragen, antwoorden) in een tabelvorm.  Fouten worden aangegeven en je kunt elke vraag en groep aanklikken (de ID's of de variabelen in vergelijkingen) om in een nieuw venster die vraag / groep te wijzigen. Je kunt daarna snel opnieuw de controle uitvoeren, voordat je enquête activeert.

Het overzicht is ook zo ontworpen dat onderzoekers het kunnen lezen en de nauwkeurigheid kunnen valideren van het ontwerp en de logica van de enquête. De functie ververst de cache voor alle gebruikte expressies van de geselecteerde enquête.

De kolommen zijn:

  • # - toont een teller van de volgorde van groepen en vragen, beginnend bij 0.
  • Naam [ID]- toont de vraagcode voor de groep / vraag / subvraag. Deze codes kunnen worden gebruikt als variabelen binnen expressies. ID is de vraag-id (QID) of het groeps-id (GID). Dit veld toont ook het vraagtype (bijv. Meerkeuzevraag [M])).


Lees meer over welke variabelen in expressies kunnen worden gebruikt,


  • Relevance [Validation] (Default) - shows the following:
    • Relevance - the syntax-highlighted relevance equation for the question or group. If it is always true (to be shown in any scenario), the value will be 1.
    • Validation - ExpressionScript automatically generates the validation equation based upon the selected question attributes (e.g., min/max number of answers, min/max/equals sum values, min/max individual values or regular expression validation). This section shows the generated validation equation so that you can detect if there are any errors (such as undefined variables).
    • Default - if the question has a default value, it is shown here, syntax-highlighted (since the default could be an expression).
  • Text [Help] (Tip) - shows the following:
    • Text - the text of the group, question, subquestion, or answer. It is syntax-highlighted to show any embedded tailoring, thus letting you verify that you have declared all the variables you plan to use in the tailoring.
    • Help - this shows the help text for the question, also syntax-highlighted.
    • Tip - this shows the internally generated validation tip, based upon the question attributes. This same tip is used in all survey styles, plus in the printable survey and data entry screens.
    • Question Attributes - this shows a table of all relevant question attributes for this question. Attributes that might be equations are syntax-highlighted so that you can validate their accuracy.

Het gebruik van kleuren:

  • Groep - een lichtgrijze achtergrond
  • Vraag - een lichtgroene achtergrond
  • Subvraag - een lichtgele achtergrond
  • Antwoord - een witte achtergrond

Bij antwoorden is er een extra attribuut in de kolom Relevantie:

  • Value - de standaard waarde die intern gebruikt wordt bij berekeningen.  Als je beoordelingen gebruikt, is het de beoordelingswaarde.  Anders is het de antwoordnaam.


De beschrijving van de enquête, de welkomst- en eindtekst, de eind-URL, de gegevensbescherming en label staan in het logicabestand van de enquête (boven de tabel) als de bijbehorende velden niet leeg zijn!

Gebruik

Bovenaan het overzicht staat een samenvatting van het resultaat van de controle. Als er geen problemen zijn, staat er "Geen fouten gevonden in de enquête", of "Deze groep bevat geen fouten" of "Deze vraag bevat geen fouten".  Als er wel fouten zijn: "X vragen bevatten fouten die verbeterd moeten worden" (of "X vraag bevat fouten die verbeterd moeten worden").

Elke vraag met een fout wordt met rood gemarkeerd (en de achtergrondkleur van de linkerkolom ("#")).  Ook staat er een waarschuwing met het aantal fouten in de vraag onder de kolom Naam [ID]. De meest voorkomende fouten zijn:

  • Undefined variable - if you have not defined all of your variables, or mistyped array_filter (or different sets of answer options for array_filter), then some of your validation questions will show errors. Undefined variables are shown in red text, boxed with a red line.
  • Bad syntax - as you start to use relevance equations, you may use too many or too few parentheses. Such syntax problems are highlighted and boxed in red. If you hover the mouse over any such red-boxed text, a tool-tip will describe the error.


Niet gedefinieerde variabele

De naam van de niet gedefinieerde variabele is in het rood in een rood omlijnd vak.  Als je er met de muis overheen gaat, krijg je de melding "Onbekende variabele":



  Attentie : Let op: LimeSurvey staat niet toe dat een vraagcode in een enquête niet uniek is. Het kan echter voorkomen dat er vergelijkbare vraagcodes in een enquête zijn als je een vraaggroep of een vraag importeert die dezelfde vraagcode gebruikt als een van de al bestaande vragen. De vraag kan nog steeds worden geïmporteerd omdat de vraag-ID's anders zijn. Als je echter de resultaten van de enquête wilt exporteren om de enquêteresultaten (R of SPSS) verder te onderzoeken, wees dan voorzichtig, want de vraagcode wordt als een variabele gezien!



}}

Syntaxfout

De meeste van de fouten in expressies hebben te maken met slechte syntaxis. Dit hangt samen met het feit dat enquêtebeheerders meestal vergeten om een ​​accolade toe te voegen, om op de juiste manier gebruik te maken van haakjes, of ze gebruiken expressies verkeerd:



Voorbeelden van het met kleur markeren, oftewel syntax markering.


Fouten in eigen JavaScript

The JavaScript errors will also be highlighted in the survey logic check:


Bestand: javascript_error.jpg


Snel wijzigen en valideren

All of the syntax-highlighted text has tooltips embedded, which are clickable:

  1. Tooltips
    • Functions - hovering the mouse lets you see the purpose and syntax definition of the function;
    • Variable Names - hovering the mouse lets you see the position (group, question sequence), question text, and allowable answers for the question.
  2. Actions
    • Variable Names - clicking on the variable name opens a new window that allows you to edit the question. This makes it easy to navigate and verify logic - simply keep clicking on variable names of relevance or validation criteria for the question to see where they come from and how they are used.


Voorbeelden

De volgende voorbeelden komen uit de ExpressieScript voorbeeld enquêtes.  Er staan schermafdrukken van enquêtes die uitgevoerd worden, uitleg en mogelijke downloads.


Body Mass Index

Here are screenshots of this example.

This is the question-reorder view of the Body Mass Index calculation. You can see the relevance equations for weight, height, and BMI under the Question column:



For a better survey overview, check the survey logic page:



This survey example is also a good example of nested if() statements to generate the "weightstatus".


Cascading logic

Here are screenshots of this example.

It shows the subquestion validation logic that is automatically generated when you use array_filter and array_filter_exclude. This example also shows how you can substitute the tailored "Other" value (the answer for Q02_other is Q01_other).



Q05 in this example shows simultaneous use of array_filter and array_filter_exclude on Q01 and Q02, respectively. This example demonstrates cascading array_filter capabilities. Note that one of the main reasons for showing the question and subquestion level validation criteria is to help ensure you have not made any typos in specifying the array_filter or array_filter_exclude variable names (or in case you use different variable names for your list of filtered subquestions). If you have such typos, all the invalid variable names will appear in red indicating that they are undefined, letting you quickly fix the problem.



Dynamic relevance

This example demonstrates dynamic cascading relevance logic to control display of question visibility. You can download this example here.

Also note that questions are displayed only if certain validation criteria are met. For example, if a person states that she has 2 kids, certain questions have to be filled in by the respondent (kid1 and kid2).


Group-level relevance

This example shows how group-level relevance appears in the logic check. Here are screenshots of the example described below.

As you can see, the group-level relevance equation (cohabs > 1 && p1_rel != "") appear in the grey Person 2 row for G-2.

You may also notice that all of the questions are mandatory. However, if the group is irrelevant, so are all its questions. As a result, those questions are only truly mandatory if the group is relevant.

You may also note that certain questions are displayed only if the answer to the previous question is not empty. You may see below that if p2_sex is not filled in, p2_name is not going to be displayed, even though it is a mandatory questions. The mandatory question p2_age is also not going to be displayed if p2_name is not filled in. These questions can be considered "conditionally mandatory".

Additionally, note that the tip messages are also automatically created for you. They are organized by value range (min/max), sum value range (min/max/equals), number of answers (min/max), etc (it depends on the used question type and active attributes). Sometimes you want to validate an answer range but don't want to display what might appear to be silly validation tips to the user. In such cases, you can use the hide_tip question option (as in this case, to avoid telling the user that the age must be between 0 and 115 unless they try to enter a bad value - see p2_age).


Comma as radix (decimal) separator

Although LimeSurvey fully supports the use of comma as radix (decimal) separator at run-time, you must still use a decimal as the radix separator at the design-time (e.g., when specifying min/max values in advanced question attributes). The working example can be found here.

Also, remember that the validation logic is created for you automatically from the enabled question attributes. The equations may look overwhelming, but you don't need to worry about them.