Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple array formula needed

Status
Not open for further replies.

MSBrady

Technical User
Mar 1, 2005
147
0
0
US
Oy!
CR 2008
No access to DB
Epic source data

I always have trouble with array formulas. I have 2 TABLES named CLARITY_EDG and HSP_ACCT_DX_LIST. HSP_ACCT_DX_LIST is linked to CLARITY_EDG w/ a LOJ on DX_ID. In the report I need some identifying information, the primary diagnosis and ALL secondary diagnosis's. Diagnosis'? Diagnosi? IDK
HSP_ACCT_DX_LIST.Line = 1 defines the primary diagnosis. No sweat. But a patient could have 100 secondary codes (HSP_ACCT_DX_LIST.Line = 2 to ???). So I need to be able to string together ALL secondary codes separated by commas into one colume on the report. Ubounds, redims, arrays, loops - crosseyed.

Can you help? Please and thank you.
 
Diagnoses.

You don't really have to use an array here, just create a set of formulas like this:

//{@reset} for the patient group header:
whileprintingrecords;
stringvar sec;
stringvar prim;
if not inrepeatedgroupheader then (
prim := "";
sec := ""
);

//{@accum} for the detail section;
whileprintingrecords;
stringvar sec;
stringvar prim;
if {HSP_ACCT_DX_LIST.Line} = 1 then
prim := {HSP_ACCT_DX_LIST.Diagnosis};
sec := sec +
(
if {HSP_ACCT_DX_LIST.Line} <> 1 then
{HSP_ACCT_DX_LIST.Diagnosis} + ", " else
""
);

//{@displayprim} for the patient group footer:
whileprintingrecords;
stringvar prim;

//{@displaysec} for the patient group footer:
whileprintingrecords;
stringvar sec;
if len(sec)>2 then
left(sec,len(sec)-2)

Then drag the groupname into the group footer next to the display formulas, and then suppress the details and group header.

-LB
 
That worked a treat! As always your expertise is very much appreciated.
 
Used this again today. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top