I really need help in modifying this program to only pull results within a specified date range, any help would be appreciated.
DROP PROGRAM vccl_clinical_intervention_tfh GO
CREATE PROGRAM vccl_clinical_intervention_tfh
prompt
"Output to File/Printer/MINE" = "MINE" ;* Enter or select the printer or file name to send this report to.
with OUTDEV
;Request HNAM sign-on when executed from CCL on host
IF (VALIDATE(IsOdbc, 0) = 0) EXECUTE CCLSECLOGIN ENDIF
SET MaxSecs = 0
IF (VALIDATE(IsOdbc, 0) = 1) SET MaxSecs = 15 ENDIF
SELECT INTO $OUTDEV
P.NAME_FULL_FORMATTED,
E.LOC_FACILITY_CD,
E_LOC_FACILITY_DISP = UAR_GET_CODE_DISPLAY( E.LOC_FACILITY_CD ),
E.LOC_NURSE_UNIT_CD,
E_LOC_NURSE_UNIT_DISP = UAR_GET_CODE_DISPLAY( E.LOC_NURSE_UNIT_CD ),
E.LOC_ROOM_CD,
E_LOC_ROOM_DISP = UAR_GET_CODE_DISPLAY( E.LOC_ROOM_CD ),
E.LOC_BED_CD,
E_LOC_BED_DISP = UAR_GET_CODE_DISPLAY( E.LOC_BED_CD ),
PA.ALIAS_POOL_CD,
PA_ALIAS_POOL_DISP = UAR_GET_CODE_DISPLAY( PA.ALIAS_POOL_CD ),
PA.ALIAS,
EA.ALIAS_POOL_CD,
EA_ALIAS_POOL_DISP = UAR_GET_CODE_DISPLAY( EA.ALIAS_POOL_CD ),
EA.ALIAS,
O.UPDT_DT_TM "@MEDIUMDATETIME",
E.ENCNTR_ID,
O.EVENT_CD,
O_EVENT_DISP = UAR_GET_CODE_DISPLAY( O.EVENT_CD ),
O.EVENT_ID,
O.RESULT_VAL
FROM
OMF_CLINICAL_EVENT_ST O,
ENCOUNTER E,
PERSON P,
ENCNTR_ALIAS EA,
PERSON_ALIAS PA
PLAN O
;WHERE O.EVENT_CD =3129623
Where O.EVENT_CD in (3129593, 3129599, 3129602, 3129605, 3129608, 3129614, 3129611,
3129596, 3129620)
JOIN E
WHERE O.ENCNTR_ID = E.ENCNTR_ID
JOIN P
WHERE P.PERSON_ID = E.PERSON_ID
JOIN EA
WHERE EA.ENCNTR_ID = E.ENCNTR_ID
AND EA.ALIAS_POOL_CD = 3559679
JOIN PA
WHERE PA.PERSON_ID = P.PERSON_ID
AND PA.ALIAS_POOL_CD = 3559682
ORDER BY P.NAME_FULL_FORMATTED,
O.UPDT_DT_TM DESC
WITH MAXCOL = 300, MAXROW = 500 , DIO = 08
END
GO
DROP PROGRAM vccl_clinical_intervention_tfh GO
CREATE PROGRAM vccl_clinical_intervention_tfh
prompt
"Output to File/Printer/MINE" = "MINE" ;* Enter or select the printer or file name to send this report to.
with OUTDEV
;Request HNAM sign-on when executed from CCL on host
IF (VALIDATE(IsOdbc, 0) = 0) EXECUTE CCLSECLOGIN ENDIF
SET MaxSecs = 0
IF (VALIDATE(IsOdbc, 0) = 1) SET MaxSecs = 15 ENDIF
SELECT INTO $OUTDEV
P.NAME_FULL_FORMATTED,
E.LOC_FACILITY_CD,
E_LOC_FACILITY_DISP = UAR_GET_CODE_DISPLAY( E.LOC_FACILITY_CD ),
E.LOC_NURSE_UNIT_CD,
E_LOC_NURSE_UNIT_DISP = UAR_GET_CODE_DISPLAY( E.LOC_NURSE_UNIT_CD ),
E.LOC_ROOM_CD,
E_LOC_ROOM_DISP = UAR_GET_CODE_DISPLAY( E.LOC_ROOM_CD ),
E.LOC_BED_CD,
E_LOC_BED_DISP = UAR_GET_CODE_DISPLAY( E.LOC_BED_CD ),
PA.ALIAS_POOL_CD,
PA_ALIAS_POOL_DISP = UAR_GET_CODE_DISPLAY( PA.ALIAS_POOL_CD ),
PA.ALIAS,
EA.ALIAS_POOL_CD,
EA_ALIAS_POOL_DISP = UAR_GET_CODE_DISPLAY( EA.ALIAS_POOL_CD ),
EA.ALIAS,
O.UPDT_DT_TM "@MEDIUMDATETIME",
E.ENCNTR_ID,
O.EVENT_CD,
O_EVENT_DISP = UAR_GET_CODE_DISPLAY( O.EVENT_CD ),
O.EVENT_ID,
O.RESULT_VAL
FROM
OMF_CLINICAL_EVENT_ST O,
ENCOUNTER E,
PERSON P,
ENCNTR_ALIAS EA,
PERSON_ALIAS PA
PLAN O
;WHERE O.EVENT_CD =3129623
Where O.EVENT_CD in (3129593, 3129599, 3129602, 3129605, 3129608, 3129614, 3129611,
3129596, 3129620)
JOIN E
WHERE O.ENCNTR_ID = E.ENCNTR_ID
JOIN P
WHERE P.PERSON_ID = E.PERSON_ID
JOIN EA
WHERE EA.ENCNTR_ID = E.ENCNTR_ID
AND EA.ALIAS_POOL_CD = 3559679
JOIN PA
WHERE PA.PERSON_ID = P.PERSON_ID
AND PA.ALIAS_POOL_CD = 3559682
ORDER BY P.NAME_FULL_FORMATTED,
O.UPDT_DT_TM DESC
WITH MAXCOL = 300, MAXROW = 500 , DIO = 08
END
GO