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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array handling

Status
Not open for further replies.

pungohboy

MIS
Feb 17, 2005
32
US
I am writing a crystal report that will track “CS” services provided to clients. Each client must have at least two “CS” services within a month, however the two services can not be on the same date. In the report I am listing each staff person and each client assigned to them.

My report is grouped as follows:

Group 1 Staff_assignment.StaffID
Group 2 Tx_history.patid
Group 3 Tx_history.patid

I am displaying on group 3 date of service, Patient ID , Patient name, staff name & ID, Previous date of service (Previous({tx_history_all.date_of_service})).

I have created a simple array to store the dates of service and service codes.

//DetailsStringArray
whileprintingrecords;
global stringvar STRING1;
global stringvar STRING2;
shared numbervar counter;

counter:=counter+1;
counter/100;

STRING1:= STRING1 & "," & {tx_history_all.date_of_service};
STRING2:= STRING2 & "," & {tx_history_all.SERVICE_CODE};

Which displays data as:
,10/17/2007,10/17/2007,10/23/2007,10/31/2007,11/15/2007,11/21/2007,11/26/2007,11/26/2007,11/28/2007,11/29/2007

,CS201,CS207,CS200,CS200,CS200,CS207,CS200,CS207,CS207,CS207

As you can see the most recent data is at the end of the string. I am having considerable trouble getting the information out of this string to compare with the current date of service.

I can get the latest data with this formula :

whileprintingrecords;

global stringvar STRING1;
shared numbervar temp;
shared numbervar temp1;


temp:=(length({@Display Array1}));
temp1:=InStrRev ({@Display Array1},",",temp);

But I am unable to get the date just before that the latest date.
Any help would be appreciated.
 
Why are you using arrays? Is your date field a datetime? You could use a sql expression {%date} to return just the date:

trunc(table.`datetime`)

Then set up your groups like this:
Group1: staff
group2: patient
Group3: {%date} on change of month
Then do a distinctcount of {%date} within the month group. To display clients without 2 dates per month, go to report->selection formula->GROUP and enter:
distinctcount({%date},{%date},"monthly") < 2

-LB
 
Thanks,

Your instructions did list each client who has not had (2) CS services within one month. The report also now displays each month that the client only received (1) CS service. Is there away to display this information based on the last CS service provided only? If no, this will work as the staffs supervisor may want to know that as well.
 
If a customer has several months of service and in the most recent month has two services, but in previous months had only one, what would you expect to see?

-LB
 
Ideally the report requester would like to only see those months in which there is only one service.
 
That is what my suggestion already does, so I'm unclear on what you are expecting. Could you show a sample of what you are getting and then show how you would like it to appear?

-LB
 
Actually after posting I was able to get it working. Thank you very much for your help. Sorry I forgot to post earlier that it is now working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top