GetCDMVisitId¶
Looks up a visit id on a named CDM table by key with the narrowest matching date interval.
Collects a visit id from a named table — typically visit_occurrence or
visit_detail. The returned id is the one whose start_date/end_date
interval most narrowly contains the start date (and optional end date)
given as parameters.
Parameters¶
Default key/value, single date¶
- 1 —
tableMandatory — accepts: table -
The CDM table the id is collected from, in
@-notation. With this form the key field defaults to<table_name>_source_valueand the value field to<table_name>_id. - 2 —
keyValueMandatory — accepts: field -
Field whose value must match the key field on the CDM table.
- 3 —
dateMandatory — accepts: field -
A date field whose value must be contained in the visit interval.
Default key/value, start/end date¶
- 1 —
tableMandatory — accepts: table -
The CDM table, in
@-notation. - 2 —
keyValueMandatory — accepts: field -
Field whose value must match the key field on the CDM table.
- 3 —
startDateMandatory — accepts: field -
Start date — the visit interval must contain this value.
- 4 —
endDateMandatory — accepts: field -
End date — the visit interval must contain this value.
Explicit key/value fields¶
- 1 —
tableMandatory — accepts: table -
The CDM table, in
@-notation. - 2 —
keyMandatory — accepts: field -
The key field on the CDM table, in
:-notation. Defaults to<table_name>_source_valueif omitted. - 3 —
valueMandatory — accepts: field -
The value field on the CDM table, in
:-notation. Defaults to<table_name>_idif omitted. - 4 —
keyValueMandatory — accepts: field -
Field whose value must match the key field.
- 5 —
startDateMandatory — accepts: field -
Start date of the interval to match.
- 6 —
endDateMandatory — accepts: field -
End date of the interval to match.
Input type¶
Parameter 1 is the CDM table; parameters 2 and 4 are field references of any matching type; parameters 5 and 6 are date fields.
Output type¶
The output type matches the type of the value field.
Examples¶
Default fields, single date
Default fields, start and end date
Explicit key/value with start and end date
GetCDMVisitId(@visit_occurrence, :visit_occurrence_source_value, :visit_occurrence_id, :recnum, :start_date, :end_date)