WaihonaPedia support page

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.

About the website contents

All of the information on this WebSite is for education purposes only. The place to get specific medical advice, diagnoses, and treatment is your doctor. Use of this site is strictly at your own risk. If you find something that you think needs correction or clarification, please let us know at: 

Send a email: info@cdlsWorld.org