Skip to content
Dustin edited this page May 2, 2017 · 7 revisions

redcap-export-file exports a file from a REDCap project.

Note: The response is either a string, in case errors are encountered, or a list with the header in the first field and the u8vector data in the second field. The filename can be retrieved from the header using (redcap-get-filename).

Parameter Description
host Server hostname
token Authentication token (project and user specific!)
record Primary id of record
field Field variable name for which the file to be downloaded
xargs Optional: Additional parameters, such as 'event, 'repeat, or 'form can be specified here

Example

Example 1: Export a file from a project.

> ;;Testing Export File function
> (define redcap:token "54CC....CC10")
> (define redcap:hostname "redcap.INSTITUTIONNAME.ca")
> (let ((fileout (redcap-export-file redcap:hostname redcap:token "4" "file2")))
    (if (string? fileout) (display fileout))
    (if (list? fileout) (display (u8vector->string (cadr fileout)))))
There is no file to download for this record
> (let ((fileout (redcap-export-file redcap:hostname redcap:token "1" "file2")))
    (if (string? fileout) (display fileout))
    (if (list? fileout) (display (u8vector->string (cadr fileout)))))
"Name","Color","Number"
"Sven","red",3
"Tom","green",44

Clone this wiki locally