Repository navigation
Select record in SV for which e.g. LB.VISITNUM = SV.VISITNUM #125
|
For Findings datasets, I need to retrieve the record from SV (Subject Visits) with the same VISITNUM as in my Findings dataset for my subject.
I do however that the operation returns a List/Array, so that "equal_to" is not appropiate. ANYWAY, it must exactly match the value in LB ... Can anyone provide me a suggestion? |
Replies: 3 comments 1 reply
|
I passed your request through a model I use for another project because I was interested in what I would get as a response. What do you think? A well-known pattern in the CDISC Rules Engine, and it avoids the array problem entirely by using group on a grouping operation ( Group by both That merge is the LB.VISITNUM = SV.VISITNUM join. Each LB record already gets its own matching SV value attached. Distinct doesn't work for this because it returns a set per group even when grouped. Since SV should have exactly one record per USUBJID+VISITNUM, Check:
all:
- name: VISITNUM
operator: exists
- name: VISITNUM
operator: non_empty
- name: LBDTC
operator: date_less_than # or date_greater_than, whichever direction you're flagging
value: $sv_svstdtc
Operations:
- operator: min_date
domain: SV
name: SVSTDTC
id: $sv_svstdtc
group:
- USUBJID
- VISITNUMDrop your equal_to $sv_visitnum condition and the separate distinct Operation entirely — the group: [USUBJID, VISITNUM] on the min_date operation will do the join for you. NOTE: it's a left merge, so a Findings record whose VISITNUM has no matching SV record will get a null $sv_svstdtc — decide whether you want/need an extra exists/non_empty check on $sv_svstdtc before the date comparison, depending on how your rule should treat unmatched visits. |
|
Great! It works now! |
|
Excellent! I hope that helps you enjoy your long weekend! |
I passed your request through a model I use for another project because I was interested in what I would get as a response. What do you think?
A well-known pattern in the CDISC Rules Engine, and it avoids the array problem entirely by using group on a grouping operation (
min_date/max_date/min/max) instead of distinct.Group by both
USUBJIDandVISITNUM, so the engine computes the value per group and then left-merges it back onto your Findings dataset row-by-row on those same key columns.That merge is the LB.VISITNUM = SV.VISITNUM join. Each LB record already gets its own matching SV value attached.
Distinct doesn't work for this because it returns a set per group even when grouped.
min_date