Closed nathhenry3 closed 2 months ago
Looks like you need to also provide the repeat_instrument parameter.
Ahh that's working now, thank you. However this was not immediately obvious on first sight.
Is it possible to include some sort of error message if repeat_instance is modified, but repeat_instrument is not included? Currently the download silently reverts to the first instance, which is easy to miss.
@nathhenry3, I finally pulled @BlairCooper's improvements and added the tests. I'm pulling it into the main branch in a few minutes. Tell me if this doesn't fix you scenario. Or if you'd like to change the documentation.
I am trying to use the redcap_download_file_oneshot() function to extract files for specific variables from a large REDCap project. This project has repeating instruments, and so I am running the function in a loop for multiple values of 'instance' to download all files for each repeated instance.
However, it appears that the function is only downloading the file from the first instance of the repeating instrument, regardless of the value of repeat_instance.
Here's the code that I'm running:
file_download <- REDCapR::redcap_download_file_oneshot(redcap_uri = uri, token = api_token, record = record_id, field = field_name, event = event_name, repeat_instance = instance, directory = directory, overwrite = TRUE, verbose = TRUE )
where 'instance' changes with each iteration.
Desktop:
Thanks a lot!