Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Grouping by name with range date Post Reply Post New Topic
Author Message
kirildzolev
Newbie
Newbie
Avatar

Joined: 15 Mar 2010
Location: Macedonia
Online Status: Offline
Posts: 6
Quote kirildzolev Replybullet Topic: Grouping by name with range date
     Posted: 26 Mar 2010 at 3:09am
Hi, I'm using Crystal Reports 2008. Have problem with grouping the data by name. The problem is next:

For example let say that I have this returned from command that I have generated in Database Expert.

date      | id | Name (can be null)
---------------------------------
3/20/2010 | 1 | null
3/21/2010 | 2 | A
3/21/2010 | 3 | B
3/22/2010 | 4 | null

Report should be in group by name, showing for each date in the range 20~22

A
------
3/20/2010 | 1
3/21/2010 | 2
3/22/2010 | 4

B
-----
3/20/2010 | 1
3/21/2010 | 3
3/22/2010 | 4

I don't have idea how to group them for the range when Name is null. Will appreciate if someone give me a hint.

Edited by kirildzolev - 26 Mar 2010 at 3:22am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Mar 2010 at 4:18am
It depends on what you ant to do with the NULLs.

If you group on the Name it will insert a NULL group as teh first group.

You can either create a formula field to convert the NULLS to another text and then group on that formula field:
if isnull(table.name) then 'I am the NULL Group' else table.name
 
Or you can write a formual to change the display in the group header. Right click on the header field, go tot he Common Tab and use the formula editor for 'Display String'
IP IP Logged
kirildzolev
Newbie
Newbie
Avatar

Joined: 15 Mar 2010
Location: Macedonia
Online Status: Offline
Posts: 6
Quote kirildzolev Replybullet Posted: 26 Mar 2010 at 5:11am
Thanks for your replay.

As it is now, yes I get the null values in separate group and it shouldn't be like that. I don't need group which contain the null values.

I think I describe the problem badly.
Groups are by name and in every group there is a range date from-to. In every group(Name) I need this range from-to.
So, even if there is no name on 3/20/2010 and 3/22/2010, this rows will appear in both group A & B

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Mar 2010 at 5:19am
So if it is NULL you want it to appear in both group a and group B?
You will likely need to make sub-reports to accomplish this.
In the main report exlude all NULL records.
Group on 'Name'
suppress details
on group footer1 add a subreport using the same data source
link the subreport on 'Name'
in the subreport change the select statement to include the NULLS, something like: 
isnull(table.NameField) or {?pm-Name}={table.namefield}
Arrange your data as you want in the sub report.
IP IP Logged
kirildzolev
Newbie
Newbie
Avatar

Joined: 15 Mar 2010
Location: Macedonia
Online Status: Offline
Posts: 6
Quote kirildzolev Replybullet Posted: 29 Mar 2010 at 4:56am
This report is for attendance for employee in/out. If nobody has been on that date then it is NULL value.

For each employee there is same range of dates from/to with value(hours) if he was in or null if he hasn't

So even if on date 20th A has been and B not, both dates should appear on groups but for A there will be value and for B there will be null.

- How do I exclude the NULLS

Sorry if I ask basic questions, I am new at this
IP IP Logged
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