Merge and aggregate datasets: Difference between revisions

Content added Content deleted
(Harbour: bug fixes)
Line 848: Line 848:
aAgg := {0, 0, 0.0, ctod("19000101")} && initial values
aAgg := {0, 0, 0.0, ctod("19000101")} && initial values
DO WHILE ! Eof() .AND. xCurId == patient_id
DO WHILE ! Eof() .AND. xCurId == patient_id
aAgg := {1+aAgg[1], iif(score==0.0,aAgg[2],1+aAgg[2]), score+aAgg[3], max(visit_date, aAgg[4])} && update
aAgg := {1+aAgg[1], iif(score==0.0,aAgg[2],1+aAgg[2]), score+aAgg[3], max(visit_date, aAgg[4])} && update
SKIP
SKIP
ENDDO
ENDDO
INSERT INTO report (patient_id, n, sum_score, avg_score, max_date) ;
INSERT INTO report (patient_id, n, sum_score, avg_score, max_date) ;