R/redcap-next-free-record-name.R
redcap_next_free_record_name.Rd
Determines the next available record ID.
redcap_next_free_record_name(
redcap_uri,
token,
verbose = TRUE,
config_options = NULL,
handle_httr = NULL
)
The uri/url of the REDCap server typically formatted as "https://server.org/apps/redcap/api/". Required.
The user-specific string that serves as the password for a project. Required.
A boolean value indicating if message
s should be printed
to the R console during the operation. The verbose output might contain
sensitive information (e.g. PHI), so turn this off if the output might
be visible somewhere public. Optional.
A list of options passed to httr::POST()
.
See details at httr::httr_options()
. Optional.
The value passed to the handle
parameter of
httr::POST()
.
This is useful for only unconventional authentication approaches. It
should be NULL
for most institutions. Optional.
a base::character vector of either length 1 (if successful) or length 0 (if not successful).
If the API call is unsuccessful, a value of character(0)
will
be returned (i.e., an empty vector). This ensures that a the function
will always return an object of class
base::character.
Documentation in REDCap 8.4.0
To be used by projects with record auto-numbering enabled, this method exports the next potential record ID for a project. It generates the next record name by determining the current maximum numerical record ID and then incrementing it by one.
: This method does not create a new record, but merely determines what
Notenext record name would be.
the
Groups (DAGs) in the project, this method accounts for
If using Data Access for users in DAGs (e.g., DAG-ID);
the special formatting of the record name in this case, it only assigns the next value for ID for all numbers inside
if a DAG has a corresponding DAG number of 223 wherein
a DAG. For example, 223-1 and 223-2 already exist, then the next record will be 223-3
records if the API user belongs to the DAG that has DAG number 223. (The DAG number
-assigned by REDCap for each DAG when the DAG is first created.)
is auto
in a DAG, the method considers all records
When generating a new record name in the entire project when determining the maximum record ID, including
in that DAG but then later
those that might have been originally created
reassigned to another DAG.
: This method functions the same even for projects that do not have
Note-numbering enabled. record auto
uri <- "https://bbmc.ouhsc.edu/redcap/api/"
token <- "9A81268476645C4E5F03428B8AC3AA7B"
# Returns 6
REDCapR::redcap_next_free_record_name(redcap_uri = uri, token = token)
#> The next free record name in REDCap was successfully determined in 0.2 seconds. The http status code was 200. Is is 6.
#> [1] "6"