Allows for editing a specific field in a REDCap project while simultaneously viewing the corresponding records and fields from other forms. Supports viewing and updating records individually, with flexible field selection.
Usage
edit_REDCap_while_viewing(
DB,
optional_DF,
records,
field_name_to_change,
field_names_to_view = NULL,
upload_individually = T
)
Arguments
- DB
A validated `DB` object containing REDCap project data and settings. Generated using load_DB or setup_DB
- optional_DF
Optional data frame. A data frame containing the data to be edited. If not provided, the function will pull the data from the REDCap database using the specified `field_name_to_change`.
- records
Character or numeric vector. The records to be edited. If not provided, the function will use the unique values from the specified forms.
- field_name_to_change
Character. The field name to be changed in the REDCap database.
- field_names_to_view
Optional character vector. A list of field names to view alongside the field being edited. Defaults to `NULL`, in which case only the field being changed will be viewed.
- upload_individually
Logical. If `TRUE`, each change is uploaded individually. Default is `TRUE`.
Details
This function is useful when you want to edit specific fields in a REDCap project while also reviewing related data from other forms in the project. The `field_name_to_change` must be provided, and you can also specify additional fields to view while editing. The data is either passed through `optional_DF` or pulled from the project based on the provided field names.
See also
save_DB
for saving the modified database.