WaihonaPedia supportside

ExportResearchCSVMacro


Usage

  • When a user is viewing a Research page and the export button (Send the answers) is pressed, the macro {{exportResearchToCSV /}} is called by the page WaihonaCode/researchSheet
  • The macro can be also called on any wiki page that contains a 'WaihonaCode.researchClass' object 
  • This macro can be inserted from the Wysiwyg editor: Edit>Wysiwyg>Macro>Insert Macro>exportResearchToCSV

Options

  • This macro does not have any parameters in this version.

Code

You can see code page under WaihonaMacros/ExportResearchCSVMacro (this page). The following actions are performed:

  • Initially we get from the current research document, the 'WaihonaCode.researchClass' object and all the properties from the it. As we do not need all the information, some of these properties are skipped.
    • The names of the remaining properties and the other 4 meta elements are inserted in the table header's cells, forming the columns, respectively, the values of each property and the values of the metas are inserted in the table body cells on each row.  
  • Secondly, we grab all the questionnaires information from the research in order to populate the table.
    • For all the questionnaires from a research, we get the object of questionnaire class type (which is created dynamically depending on the questionnaire name/type) and a new row header is created with the names of obtained object properties. The values of the page properties are inserted in the cells of table body.
  • Finally, after the button is pressed, we enable the flag on send data (datasend variable) for the current user participating in the current research

Results

  • One CSV file is generated and available for download. This file needs to be opened using semicolon (;) as separator and UTF-8 as character set.

Om indholdet af hjemmesiden

Alle oplysninger på dette websted er udelukkende til undervisningsformål. Det er din læge, der er det rette sted at få specifik medicinsk rådgivning, diagnoser og behandling. Brug af dette websted sker udelukkende på eget ansvar. Hvis du finder noget, som du mener, der skal rettes eller præciseres, bedes du give os besked på: 

Send en e-mail: info@cdlsWorld.org