Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Grouping on two different sets Post Reply Post New Topic
Author Message
anushka
Newbie
Newbie
Avatar

Joined: 10 Apr 2008
Online Status: Offline
Posts: 29
Quote anushka Replybullet Topic: Grouping on two different sets
     Posted: 13 Jan 2011 at 6:49am
Hi All
 
Advice required.
 
I have a report which has two groups , depending upon the parameter selected either group 1 or group 2 or both can be displayed in the report.
 
now when group 1 dispalys , it should dispaly all the employess without any repetition.so i created a new group on employees under group 1 with name Group 2
Slly i want for other set when group 3 gets displayed all emplyess under that are grouped G4.
 
Thus its looks like this
G1 - Department :Display only when parameter matches depart
G2 -  Employees :Display only when parameter matches depart
 
G3 -Division :Display only when parameter matches Divison
G4 -Emplyess :Display only when parameter matches Division
 
When parameter is *Scien* it checks in both departments and divsion and pull all records which have verbaige with Scien in it.
 
In my case it pulls both group - Department /Divison but then it is not grouping correctly.
 
It displays same diviosn in two different groups, thus creating two rows for the description like
 
Science-Aniamal Science
Mark Keith
Science-Animal Science
Helen
 
but i want
Science -Animal Science
Mark Keith
Helen
 
Any suggestions, how to approach this.


Edited by anushka - 13 Jan 2011 at 6:50am
Learning can be fun.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2011 at 7:10am
what are the param options for the users and what should each of them do?
IP IP Logged
anushka
Newbie
Newbie
Avatar

Joined: 10 Apr 2008
Online Status: Offline
Posts: 29
Quote anushka Replybullet Posted: 13 Jan 2011 at 8:25am

there is only one parameter "name" where user can enter any wildcard character like *Scien* and the show group formula check if it is department then show group 1 and 2 or if it matches with the division thengroup 3 and 4 and if matches with both then show both.

 
 


Edited by anushka - 13 Jan 2011 at 8:25am
Learning can be fun.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2011 at 9:44am
I think I understand what you want here...
When a user enters the param you are searching both the Department Field and the Division Field and returning all records that appear in either field. When the param finds records in both fields it "messes up your grouping". It is actually grouping as you told it to but your report does not act like you want it.
Is that correct?
What is the heirachy of the Department and Division? Do they come form the same table or are you joining them?


Edited by DBlank - 13 Jan 2011 at 9:44am
IP IP Logged
anushka
Newbie
Newbie
Avatar

Joined: 10 Apr 2008
Online Status: Offline
Posts: 29
Quote anushka Replybullet Posted: 13 Jan 2011 at 12:05pm
Thanks for replying.
 
No the department and division are in different tables and they both are joined to a table through their ids like dept_id and div_id  to a main table A which stores the ids , and this A table is joined with employee id on e_id.
 
Hope that helps to understand it better.
 
 
Learning can be fun.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2011 at 12:10pm
So in your data set, if the department ID field is NULL then the Division ID is not and vice versa, correct?
Assuming so, use a formula to get all the Names into one field
if isnull(table.departmentid) then table.divisionname else table.departmentname
now change goup1 to use this formula as the grouping source and remove groups 3 and 4
You may have to do the same thing for employee for group level 2 but I am not sure as I do not know how you joined taht table in


Edited by DBlank - 13 Jan 2011 at 12:11pm
IP IP Logged
anushka
Newbie
Newbie
Avatar

Joined: 10 Apr 2008
Online Status: Offline
Posts: 29
Quote anushka Replybullet Posted: 13 Jan 2011 at 12:50pm
No the department will always have a division with it
Main table : Table Employee  :   Emplyee_id joined on employee_id with
Table Relation :      Dept_id,Div_ID ,Emplyee_id
Table Department :Joined on Dept_id with relation
Table Division:        Joined on Div_id with relation
 
Now In Report
Group 1 :Dept_ID (Show when Dept_id matches with paramter)
Group 2 :Employee_ID
 
Group 3 :Div_ID (Show when Div_id matches with paramter)
Group 4 :Employee_ID
 
Now when User response matches with a text in both department and divsion
 
it should give
 
G1Science
G2Mark
G2Julie
 
G3 Science-Medical
G4 Sam
G4 Allen
G3 Science-Animal
G4 harry
 
But it is giving
 
 
 
G1Science
G2Mark
G2Julie
 
G3 Science-Medical
G4 Sam
G3 Science-Medical
G4 Allen
G3 Science-Animal
G4 harry
 
 
 I want the group for employees to work individually for department and division but i guess now if department is true it group on employess and then if division is also true  which is the next group it takes in third priority.
 
i want group 1 and 2 to work together and 3 and 4 without any intervention from group1 and 2.Hope you are getting.
 


Edited by anushka - 18 Jan 2011 at 12:43pm
Learning can be fun.
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