Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
en:create:debugging [22.09.2017 17:33]
johannes.lotz
en:create:debugging [27.09.2017 10:57]
lchnr.web Correction of some typos from Filter questions to end
Line 1: Line 1:
-====== Questionnaire Problem Solutions ======+====== Solving Questionnaire Problems ======
  
 Getting started using [[:en:create:php|PHP-Code]] and [[en:create:javascript|JavaScript]] is not always trivial -- especially when you have a more complex task ahead of you, things do not always work out as expected. Getting started using [[:en:create:php|PHP-Code]] and [[en:create:javascript|JavaScript]] is not always trivial -- especially when you have a more complex task ahead of you, things do not always work out as expected.
Line 7: Line 7:
  
   * ... where the problem is located, when nothing is working anymore (formal errors),   * ... where the problem is located, when nothing is working anymore (formal errors),
-  * ... what is happening in the background before something appears on-screen and+  * ... what is happening in the background before something appears on-screenand
   * ... whether the expected content has been saved in variables (content errors).   * ... whether the expected content has been saved in variables (content errors).
  
 Formal errors are the easiest to find. When a semicolon is missing at the end of a command or a missing bracket (syntax error) the command code won't even be executed. SoSci Survey will then show an error message. Therefore the error console has to be opened. Formal errors are the easiest to find. When a semicolon is missing at the end of a command or a missing bracket (syntax error) the command code won't even be executed. SoSci Survey will then show an error message. Therefore the error console has to be opened.
  
-Content errors are harder to find. The code is working, but does not lead to the desired outcome. In this case the background display can help to show what is actually happening ([[#beispiel|example]]).+Content errors are harder to find. The code is working, but does not produce the desired outcome. In this case the background display can help to show what is actually happening ([[#beispiel|example]]).
  
  
Line 19: Line 19:
 Open the questionnaire in debug mode by clicking on the yellow arrow next to **run questionnaire**{{:button.debug.gif?nolink|debugging of questionnaire}}. Use the yellow arrow with protruding line {{:button.debug.here.gif?nolink|debugging from current page}} to start debug mode from a specific page. Open the questionnaire in debug mode by clicking on the yellow arrow next to **run questionnaire**{{:button.debug.gif?nolink|debugging of questionnaire}}. Use the yellow arrow with protruding line {{:button.debug.here.gif?nolink|debugging from current page}} to start debug mode from a specific page.
  
-  * In debug mode ({{:button.debug.gif?nolink|debug mode}}) and in preview mode ({{:button.run.gif?nolink|preview mode}}) you see warnings (orange) and hints (yellow) for possible problems that are not being displayed in the normal questionnaire (e.g. by applying ''value()'' to a variable that has not yet been retrieved).+  * In debug mode ({{:button.debug.gif?nolink|debug mode}}) and in preview mode ({{:button.run.gif?nolink|preview mode}}) you see warnings (orange) and hints (yellow) for possible problems that are not being displayed in the normal questionnaire (e.g.by applying ''value()'' to a variable that has not yet been used).
   * In debug mode the identifier and description is being displayed next to every question. Move your cursor over the description to make additional notes to the question. They will also be displayed in the question catalog when opening a question for editing.   * In debug mode the identifier and description is being displayed next to every question. Move your cursor over the description to make additional notes to the question. They will also be displayed in the question catalog when opening a question for editing.
   * In debug mode you have an additional control panel at the top (debug panel) to show you additional information to questions.   * In debug mode you have an additional control panel at the top (debug panel) to show you additional information to questions.
Line 29: Line 29:
 {{ :de:create:scr.debug.closed.png?nolink |Debug-Leiste ausgeblendet}} {{ :de:create:scr.debug.closed.png?nolink |Debug-Leiste ausgeblendet}}
  
-**Note:** If you start the questionnaire in debug-mode, you will find this later in your data. It will have "debug" ([[de:results:variables]]) displayed as its variable //MODE//. Use **data obtained** -> **show data** to inquire into your saved data.+**Note:** If you start the questionnaire in debug-mode, you will find this later in your data. It will have "debug" ([[en:results:variables]]) displayed as its variable //MODE//. Use **data obtained** -> **show data** to inquire into your saved data.
  
  
 ==== Navigation ==== ==== Navigation ====
  
-You've got a question designed to filter on page 2, however, the actual [[:de:create:filters|Filter]]  is found on page 10? Use the navigation in the debug control panel to directly switch between the pages.+You've got a question designed to filter on page 2, however, the actual [[:en:create:filters|Filter]]  is found on page 10? Use the navigation in the debug control panel to directly switch between the pages.
  
 {{:de:create:scr.debug.navigation.png?nolink|}} {{:de:create:scr.debug.navigation.png?nolink|}}
Line 43: Line 43:
   * Use the arrow pointing right (►), to get to the next page without checking on integrity (obligation to respond/tackling the response).   * Use the arrow pointing right (►), to get to the next page without checking on integrity (obligation to respond/tackling the response).
  
-**Hint:** If you directly jump to another page, all specifications made will be automatically savedyou do not need to click the "next" button.+**Hint:** If you directly jump to another page, the data provided will be automatically saved so you do not need to click the "next" button.
  
  
 ==== Survey Route ==== ==== Survey Route ====
  
-If you work with ''[[:de:create:functions:gotopage]]'' or  +If you work with ''[[:en:create:functions:gotopage]]'' or  
-''[[:de:create:functions:setpageorder]]'' , you might want to retrace which pages have been displayed over the course of the interview. Move your courser over the name of the survey to do so. +''[[:en:create:functions:setpageorder]]'' , you might want to retrace which pages have been displayed over the course of the interview. Move your courser over the name of the survey to do so. 
  
 {{:de:create:scr.debug.history.png?nolink|Informationen zum Fragebogen und Verlauf}} {{:de:create:scr.debug.history.png?nolink|Informationen zum Fragebogen und Verlauf}}
  
-You will see a list of pages that have been shown over the course of the interview. The most recent position will be shown in bold. By means of ''[[:de:create:functions:setpageorder]]'' or ''[[:de:create:functions:setnextpage]]'' you can decide which page shall be shown after clicking on "next"; this will be shown in the list as grey.+You will see a list of pages that have been shown over the course of the interview. The most recent position will be shown in bold. By means of ''[[:en:create:functions:setpageorder]]'' or ''[[:en:create:functions:setnextpage]]'' you can decide which page shall be shown after clicking on "next"; this will be shown in the list as grey.
  
 ==== Debug Information ==== ==== Debug Information ====
  
-Whenever you work with Wann immer Sie mit PHP-Code arbeiten, the debug information will give you helpful input. Click "debug information" on the top right to have the window fade in or out.+Whenever you work with PHP code, the debug information will give you helpful input. Click "debug information" on the top right to have the window (dis-)appear.
  
 {{ :de:create:scr.debug.information.png?nolink |Debug-Information einblenden}} {{ :de:create:scr.debug.information.png?nolink |Debug-Information einblenden}}
  
-The debug information shows the relevant steps that have happened in the background inbetween the start of the current page (e.g., by clicking on "next") and the display of the page on screen. +The debug information shows the relevant steps that have taken place in the background in between the start of the current page (e.g., by clicking on "next") and the display of the page on screen. 
 Here you can see: Here you can see:
  
-  * ... which answers have been read and been saved on your data ("Lese Antworten von Seite ...") and+  * ... which answers have been read and saved on your data ("Lese Antworten von Seite ...") and
   * ... what has been processed on the current page ("Erstelle Fragebogen-Seite Nr. ...").   * ... what has been processed on the current page ("Erstelle Fragebogen-Seite Nr. ...").
  
Line 72: Line 72:
 ==== Filter Questions ==== ==== Filter Questions ====
  
-The example used shows a survey page with a small [[:de:create:filters|Filter]].+The example used shows a survey page with a small [[:en:create:filters|Filter]].
  
 {{:de:create:scr.debug.info01source.png?nolink|Beispiel für eine Fragebogen-Seite mit Filter}} {{:de:create:scr.debug.info01source.png?nolink|Beispiel für eine Fragebogen-Seite mit Filter}}
  
-The command ''value()'' automatically generates an entry in the debug information. You can look at [[#debug-information|Debug-Information]] , to see that the PHP-Code used the command ''value('AB10')'' to deliver a value of 2. +The command ''value()'' automatically generates an entry in the debug information. You can look at [[#debug-information|Debug-Information]], to see that the PHP-Code used the command ''value('AB10')'' to deliver a value of 2. 
  
 {{ :de:create:scr.debug.info01.png?nolink |Debug-Information zur Filterfrage}} {{ :de:create:scr.debug.info01.png?nolink |Debug-Information zur Filterfrage}}
  
-Further, you can observe that item "AB09" is displayed, but "AB05" is missing in the filter -- since the value of ''2'' deliverd by ''value()'' is unequal to ''1'', for which is being filtered. +Furthermore, you can observe that item "AB09" is displayed, but "AB05" is missing in the filter -- since the value of ''2'' deliverd by ''value()'' is unequal to ''1'' which is being filtered. 
  
  
 ==== Variables ==== ==== Variables ====
  
-Using the command ''[[:de:create:functions:debug]]'' you can see the value of any variable in your data set or PHP-Code. As an example serves the following page of a questionnaire, which calculates a new value out of an open text entry of a participant in "AB11_01" while using a filter.+Using the command ''[[:en:create:functions:debug]]'' you can see the value of any variable in your data set or PHP-Code. As an example serves the following page of a questionnaire, which calculates a new value out of an open text entry of a participant in "AB11_01" while using a filter.
  
 {{:de:create:scr.debug.info02source.png?nolink|Beispiel-Fragebogenseite}} {{:de:create:scr.debug.info02source.png?nolink|Beispiel-Fragebogenseite}}
Line 91: Line 91:
 In this case the command ''debug()'' has been used twice. The parameter is once the identifier of the free text entry "AB11_01" and in the other case the PHP variable ''$num'', in which the result of said calculation is saved in. In this case the command ''debug()'' has been used twice. The parameter is once the identifier of the free text entry "AB11_01" and in the other case the PHP variable ''$num'', in which the result of said calculation is saved in.
  
-In debug mode ''debug()'' generates an output in the questionnaire itself, as well as in the [[#debug-information|Debug-Information]]. In the normal interview you won't see any of it.+In debug mode''debug()'' generates an output in the questionnaire itself, as well as in the [[#debug-information|Debug-Information]]. In the normal interview you won't see any of it.
  
 {{ :de:create:scr.debug.info02.png?nolink |}} {{ :de:create:scr.debug.info02.png?nolink |}}
  
-By first using ''debug()'', SoSci dutifully tells you that the parameter is a string with the content "AB11_01". Further, it will be recognized that it is the identifier of a variable from the data set. Which is why automatically the value (6) of the data set is shown. +By first using ''debug()'', SoSci Survey dutifully tells you that the parameter is a string with the content "AB11_01". Further, it will be recognized that it is the identifier of a variable from the data set. Which is why automatically the value (6) of the data set is shown. 
  
-By the second use of ''debug()'', SoSci will show you which current value of the PHP variable ''$num'' is saved (6). +By the second use of ''debug()'', SoSci Survey will show you which current value of the PHP variable ''$num'' is saved (6). 
  
  
Line 107: Line 107:
 {{:de:create:scr.debug.info03source.png?nolink|Eine Fragebogenseite, die u.U. leer bleibt}} {{:de:create:scr.debug.info03source.png?nolink|Eine Fragebogenseite, die u.U. leer bleibt}}
  
-In the [[#debug-information|Debug-Information]] not only can one observe why item "AB05" is not shown but also that it will automatically continue with page 4.+In the [[#debug-information|Debug-Information]] one can not only observe why item "AB05" is not shown but also that the survey will automatically continue with page 4.
  
 {{ :de:create:scr.debug.info03.png?nolink |beispiel}} {{ :de:create:scr.debug.info03.png?nolink |beispiel}}
  
-Furthermore, on the top left you can find the page numbers "3+4", which means that these pages will be shown at once. This display also results if you use ''[[:de:create:functions:gotopage]]'' : this command takes you directly from one page of the questionnaire to another.+Furthermore, as indicated by page numbers "3+4" on the top left, these pages will be shown at once. This also occurs if you use ''[[:de:create:functions:gotopage]]'': this command takes you directly from one page of the questionnaire to another.
  
  
 ==== Example ==== ==== Example ====
  
-The following PHP code shall if the value of the sum is 25 jump directly to another page of the survey and there (above other questions) show a specific text information -- but the text cannot be found:+The following PHP code shall direct you to another page of the survey and display a text there (above other questions), if the value of the sum is 25. However, the text cannot be found:
  
 <code php> <code php>
Line 125: Line 125:
 </code> </code>
  
-Here only the output of the debugging mode will help ([[#debug-information|Debug-Information]]). This shows that the command ''[[:de:create:functions:text]]'' is not being executed, the ''goToPage()'' however is. Thus it is not the filter that produces the problem.+Here only the output of the debugging mode will help ([[#debug-information|Debug-Information]]). This shows that the command ''[[:en:create:functions:text]]'' is not being executed, the ''goToPage()'' however is. Thus it is not the filter that produces the problem.
  
-Take a look a the initial of the command:''[[:de:create:functions:gotopage]]''It tells us that it will make you jump to the specific page directly without executing anything else on the page of origin. In this example, not even ''text()''. If you are aware of the cause, the solution is simple: Move ''text()'' in front of ''goTopage()''.+Take a look a the initial of the command:''[[:de:create:functions:gotopage]]''The survey redirects the participant to the specific page without executing anything else on the current page. In this example, not even ''text()''. If you are aware of this, the solution is simple: Move ''text()'' in front of ''goTopage()''.
  
 <code php> <code php>
Line 139: Line 139:
 ===== Finding Bugs in Java ===== ===== Finding Bugs in Java =====
  
-While the PHP code of SoSci Survey is being executed on the server, [[de:create:javascript|JavaScript]] will run in the browser of the participant. Accordingly the browser is responsible for finding errors and information.+While the PHP code of SoSci Survey is being executed on the server, [[en:create:javascript|JavaScript]] will run in the browser of the participant. Accordingly the browser is responsible for finding errors and information.
  
 To do so, the error log is needed. One can find it -- depending on the browser -- at different places. To do so, the error log is needed. One can find it -- depending on the browser -- at different places.
en/create/debugging.txt · Last modified: 26.11.2020 21:00 by sophia.schauer
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki