View source: R/importFileToRecord.R
importFileToRecord | R Documentation |
There are times when the user may desire to create a record
and import a file as part of a single action. For example, a study
consent form may have been collected and needs to be stored with the
data of the new study participant. importFileToRecord
extends
importFiles
to allow the concurrent creation of the record in which
the file will be stored.
importFileToRecord(
rcon,
file,
record = NULL,
field,
event,
overwrite = TRUE,
repeat_instance = NULL,
...
)
rcon |
A |
file |
|
record |
|
field |
|
event |
|
overwrite |
|
repeat_instance |
|
... |
Arguments to pass to other methods |
The behavior of importFileToRecord
depends on
whether record auto numbering has been enabled in the project,
if the record is specified by the user
if the record specified by the user exists.
The following table details the actions taken based on these conditions.
(force_auto_number
is an argument to importRecords()
).
Autonumbering enabled | record | Record Exists | Action |
Yes | NULL | No | Create a new record (using force_auto_number = TRUE ) and import the file to the new record |
Yes | Specified | Yes | Import the file to the existing record |
Yes | Specified | No | Create a new record (using force_auto_number = TRUE )and import the file to the new record |
No | NULL | No | Error: record must be provided when auto numbering is not enabled |
No | Specified | Yes | Import the file to the existing record |
No | Specified | No | Create the record (using force_auto_number = FALSE ) and import the file to the new record. |
importFiles()
,
importRecords()
## Not run:
unlockREDCap(connections = c(rcon = "project_alias"),
url = "your_redcap_url",
keyring = "API_KEYs",
envir = globalenv())
importFileToRecord(rcon,
file = "file_to_upload.txt"
record = NULL,
field = "file_upload_test")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.