MochaLatte
Technical User
Hello,
I have a report for patients each patient has different diagnosis.
For example: (Detail Section)
Patient A Chest Pain
Patient B Cough
Patient A Chest Pain
Patient B Nausea
Patient B Nausea
Patient A Headache
I need to concatenate diagnosis in the footer into a single field, it should look like this: (no repetitions)
Patient A: Chest Pain, Headache
Patient B: Cough, Nausea
I have the following array
@Initialize
whileprintingrecords;
stringvar diagnosis:="";
stringvar Admit_dept:="";
@Diagnosis
whileprintingrecords;
stringvar array summary;
numbervar array_size:=ubound(summary);
numbervar found_sw:=0;
numbervar i;
if not(isnull({PAT_ENC_RSN_VISIT.ENC_REASON_NAME}))
then
for i:= 1 to array_size do
if summary={PAT_ENC_RSN_VISIT.ENC_REASON_NAME} then
found_sw:=1;
if found_sw = 0 then
(array_size := ubound (summary) +1;
redim preserve summary[array_size];
summary[array_size]:={PAT_ENC_RSN_VISIT.ENC_REASON_NAME});
found_sw:=0
;
@Display Diagnosis
whileprintingrecords;
stringvar array summary;
numbervar array_size:=ubound(summary);
stringvar display_summary:="";
numbervar i;
for i:=2 to array_size do
(
if summary <> summary[i-1] then
display_summary:= display_summary & summary & chr(13)
);
display_summary;
Thanks for any help!!!!!
I have a report for patients each patient has different diagnosis.
For example: (Detail Section)
Patient A Chest Pain
Patient B Cough
Patient A Chest Pain
Patient B Nausea
Patient B Nausea
Patient A Headache
I need to concatenate diagnosis in the footer into a single field, it should look like this: (no repetitions)
Patient A: Chest Pain, Headache
Patient B: Cough, Nausea
I have the following array
@Initialize
whileprintingrecords;
stringvar diagnosis:="";
stringvar Admit_dept:="";
@Diagnosis
whileprintingrecords;
stringvar array summary;
numbervar array_size:=ubound(summary);
numbervar found_sw:=0;
numbervar i;
if not(isnull({PAT_ENC_RSN_VISIT.ENC_REASON_NAME}))
then
for i:= 1 to array_size do
if summary={PAT_ENC_RSN_VISIT.ENC_REASON_NAME} then
found_sw:=1;
if found_sw = 0 then
(array_size := ubound (summary) +1;
redim preserve summary[array_size];
summary[array_size]:={PAT_ENC_RSN_VISIT.ENC_REASON_NAME});
found_sw:=0
;
@Display Diagnosis
whileprintingrecords;
stringvar array summary;
numbervar array_size:=ubound(summary);
stringvar display_summary:="";
numbervar i;
for i:=2 to array_size do
(
if summary <> summary[i-1] then
display_summary:= display_summary & summary & chr(13)
);
display_summary;
Thanks for any help!!!!!