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

How to group Dates for Current month in CR-9

Status
Not open for further replies.

rkm500

Programmer
Apr 26, 2003
12
US
Hello Experts,

I am trying to create group by all dates of the current month in CR.

Such as:

12/1/05 XXX XXX XXXX
12/2/05 XXX XXX XXXX
12/3/05 000 000 000
.
.
12/31/05 XXX XXX


How can I accopmalish it?
Is there any formula that I can use to group these?
There is a function called 'MonthToDate' but it provides a boolean value.

Any help will be appreciated....
Thank you.

RKM

 
Do you mean that your trying to fabricate dates for a month, or only return rows for the current month, or?

Try posting technical information:

Crystal version
Database/connectivity used
Example data
Expected output

Data is grouped on fields in a database, not on functions.

Try supplying the above, and then try to rephrase the question.

-k
 
Hello,
Yes, I am trying to fabricate the date. Using CR9. Basically, I am trying to do the following..

On a particular date how many Patient came in the emergency room in a Hospital and how many of them were admitted.

Suppose total patient arrived on 12/17/05 (from 12:01 to 11:59PM) were 200 and out of those 200, say 50 are admitted on 12/17/05

Suppose patients those who came at 11:30 PM and by the time they were admitted it was say 4:30AM (next morning).
This patient should be appearing in Arrival data for 12/17/05 but should be documented in Admission status in the summary of 12/18/05.

The report output should look like that:

Date Tot. Arrived Tot. Admitted
12/10/05 150 20
12/11/05 200 40
12/12/05 300 93

If I group this report by Arrival date, then it provides me the correct total of all arrivals for the date but does not provide the actual count for the Tot. Admitted. It only provides the patient that were Admitted on the date on that the data are grouped. Suppose on a given date say 12/10/05 -- 20 patients were admitted plus a few patients that were admitted but their arrival date was of the previous day (12/09/05) .

So, How can I group this report when I need two different totals for two different or same date in One group line:

Like 12/10/05: Patients those were admitted may arrive on previous day as well.

I hope I clarified this scenerioo.

Thank you.

RKM
 
Sorry, forgot, I am using Oracle database for this report. Cr version is 9.
 
I'd use a UNION ALL query in an Add Command as follows:

select 'arrival' datasource, count(table.patient) mycount, table.arrivaldate from table
group by table.date
UNION ALL
select 'admitted' datasource, count(table.patient) mycount, table.date from table
group by table.admitteddate

Now group by the date, and create 2 formulas:

if datasource = "arrival" then
mycount

the other would be:

if datasource = "admitted" then
mycount

Drop them alongside each other in the group footer, and suppressw the group header and detail section.

This offloads the work to the database, and will provide what you require.

-k
 
Thank you for your prompt response.
You referred to "use a UNION ALL query in an Add Command "

What is Add Command ? I didn't see this in Crystal Reports. You probably mean to create a view in Oracle first and then use that view as the Datasource. Is this you meant?

If the 'Add Command' is part of Crystal Reports, please let me know as how I can get to it. It will be really very helpful and it will resolve my problem.

Thank you.

RKM
 
Go to database->database expert->yourdatasource->add command (should be the first thing listed).

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top