Solved

Count function in Crystal

Posted on 2008-10-23
10
1,140 Views
Last Modified: 2011-10-19
Hi.  I need to do a simple record count in CR.
Fields: an integer, a datetime stamp.
I need a count by day/date/year of events each day:
5813      10/24/2008     7
5813       10/25/2008    6

SQL is a cinch:

SELECT     didnumber,LEFT(CONVERT(varchar(11), starttime, 101),11) as start
into temp1
FROM         CallLog
WHERE     (DIDNumber IN (5290, 5813))

select didnumber,start,count(*) total
from temp1
group by didnumber,start
ORDER BY DIDNumber, Start

How is this done in CR Design?
Thanks.
0
Comment
Question by:michaelheffernan
  • 6
  • 4
10 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 22792069
You can group the report by date 3 times
For the first select the timeframe as YEAR
Second group timeframe is month
third timeframe is day

Then use summaries at the group level to count the events.

mlmcc
0
 

Author Comment

by:michaelheffernan
ID: 22797940
Hmmmmm.... lemme think about this 'un...
0
 

Author Comment

by:michaelheffernan
ID: 22800211
Hi.  Well, I kinda get the logic.  I don't see how to parse the year/month/day out of this datetime field for each grouping.  CR wants to group the field, period.

How do I parse out each element of the datetime field?
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 100

Expert Comment

by:mlmcc
ID: 22800615
When you create the group, since it is a date field you get an extra option for the interval to group on.

mlmcc
GroupingByDate.jpg
0
 

Author Comment

by:michaelheffernan
ID: 22817498
Ah, different version.
 
I do not have such options.  I so rarely have to do something like this that I have never upgraded CR thru its ownership changes.
This may not be possible with this version.

1.jpg
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 125 total points
ID: 22819068
You need to choose a DATE field.

mlmcc
0
 

Author Comment

by:michaelheffernan
ID: 22827200
Ah, oops, yes.  Okay, lemme try it...
0
 

Author Comment

by:michaelheffernan
ID: 22827213
Ah, I see, I see, sayeth the blind man.  Okay, thanks, I believe I can sort this out; thank you.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 22854400
WHy accept that comment as the answer when the comment from the expert is the answer.  

mlmcc
0
 

Author Closing Comment

by:michaelheffernan
ID: 31509479
Thank you.  I probably clicked the wrong link or wrong comment to accept as a solution.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Sum of items in two tables not equal. 5 43
Star schema daily updates 2 33
SQL Query Task 11 42
Trigger C# code inside the SQL Server 6 25
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question