Releases: ctsit/default_from_query
v2.0.1
REDCap Default From Query
Default From Query is a REDCap External Module that allows REDCap fields to be auto-populated with values derived from SQL queries against REDCap's own database. Queries are defined by a system administrator at the project level and referenced by name from a field's action tag.
Release 2.0.0 provides these features and changes:
Breaking changes
- Rename smart variable placeholders to use hyphens instead of underscores:
[project_id]→[project-id],[record_id]→[record-name],[field_name]→[field-name],[pid1]/[pid2]/[pid3]→[pid-1]/[pid-2]/[pid-3],[data-table:pid1]/[data-table:pid2]/[data-table:pid3]→[data-table:pid-1]/[data-table:pid-2]/[data-table:pid-3](@pbchase, @grezniczek)
Enhancements
- Add read-only scanner to detect and reject queries that attempt to write to the database (@grezniczek)
- Add smart variable placeholders for
[record-dag-id],[event-id], and[current-instance](@grezniczek) - Always issue rollback after query execution (@grezniczek)
Bug fixes
- Fix pid key mismatch so
[pid-1]/[pid-2]/[pid-3]substitution works (@pbchase) - Replace
$_GETusage incurrentFormHasDatawith hook parameters (@pbchase) - Fix stale docblock, inconsistent
getDataTablecall, and README typo (@pbchase)
Other
- Add note/limitation regarding draft preview mode (@grezniczek)
- Add author Günther Rezniczek to CITATION.cff (@grezniczek)
REDCap Default From Query
Default From Query is a REDCap External Module that allows REDCap fields to be auto-populated with values derived from SQL queries against REDCap's own database. Queries are defined by a system administrator at the project level and referenced by name from a field's action tag.
Release 1.0.1 provides these features:
@DEFAULT-FROM-QUERY action tag
Fields annotated with @DEFAULT-FROM-QUERY='query_name' are automatically populated with the result of a named SQL query when a data entry form is opened for a record that has no existing data on that form.
Project-level query configuration
Queries are defined in the module's project settings. Each query entry has a name (referenced in the action tag), a SQL statement (editable by REDCap Admins only), and up to three optional additional project IDs (pid1, pid2, pid3) for queries that need to reference data from other projects.
SQL variable substitution
SQL queries may use the following placeholders, which are substituted with current context values before execution:
[record_id]— the current record ID[project_id]— the current project ID[field_name]— the name of the field being populated[pid1],[pid2],[pid3]— the additional project IDs configured for the query[data-table]— the REDCap data table for the current project[data-table:pid1],[data-table:pid2],[data-table:pid3]— the REDCap data table for the corresponding additional project