Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Arrays Post Reply Post New Topic
Author Message
bikerbabe1
Newbie
Newbie
Avatar

Joined: 29 Nov 2011
Location: United States
Online Status: Offline
Posts: 1
Quote bikerbabe1 Replybullet Topic: Arrays
    Posted: 29 Nov 2011 at 6:50am

I need help with Array processing in Crystal. I would like to keep track of certain meds a patient has  and based on the combination of meds, assign a code. For example: If a patient has Aspirin and Plavix, I would assign a code 2, If a patient has Plavix only, I would assign a code 1, If that patient has Aspirin, Plavix and Coumadin I would assign a code 3.

Any help would be appreciated!

 

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Nov 2011 at 9:11am
what a potentially messy / hard to maintain report....
 
with that said, I would try something like:
in group header
shared stringvar array meds;
shared numbervar medIndex := 1;
redim meds[100];
 
in details
shared stringvar array meds;
shared numbervar medIndex;
meds[medIndex] := {table.med};
medIndex := medIndex + 1;
 
in the footer:
there would be lots of loops and ifs but a start would be:
shared stringvar array meds;
shared numbervar medIndex;
 
if medIndex = 1 then (
  if med[1] = "Plavix" then 1
  if med[1] = "xxx" then x
)
 
if medIndex = 2 then (
  if (medIndex[1] = "Aspirin" or medIndex[2] = "Aspirin") and (medIndex[1] = "Plavix" or medIndex[2] = "Plavix") then 2
 
 
etc.
 
 you might need to formulate some loops if your combinations become too numerous.
 
HTH
 
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.