Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Condition on group header - how? Post Reply Post New Topic
Author Message
APS_LSWE
Newbie
Newbie


Joined: 11 Feb 2008
Location: Romania
Online Status: Offline
Posts: 3
Quote APS_LSWE Replybullet Topic: Condition on group header - how?
     Posted: 11 Feb 2008 at 12:30am
Hello,

I have a table in my DB with 3 fields : code, level, label. "Code" is varchar, "level" varies from 1 to 10 (integer).

I want to insert a group header for "code" (in order to do the sorting) but only for those lines where level = 1. The lines with level > 1 will be in the details lines.

In the group header, i will have the code and the label. Now comes the problem: if i put the group header simply by "code", with no condition, the label will be wrong (will belong to some other line... with label > 1).

So i want to put some condition on the group header to take into consideration the lines with level = 1 ONLY.

For example if i have the lines :

abc, 1, label level1
abc, 2, label level2
abc, 3, label level3

i want to show:

GH : abc label level1
D:                label level2
D:                label level3

and what it shows now is something like:

GH : abc label level3
D:                label level1
D:                label level2

Thanks in advance for any answers.


Edited by APS_LSWE - 11 Feb 2008 at 12:48am
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 12 Feb 2008 at 1:46am
Hi
 
Create GROUP ON LEVEL which is numeric field
 
select  options then in common tab select in specified order  then in
 
Named Group enter the name GH :abc  select the value as 1  click ok
 
This will create the Groups with ABC and OTHERS  the display will be as below
 

ABC                        Label level 1

 

Others                        Label level 2

                        ABC                 2.00                        Label level 2

                        ABC                 3.00                        Label Level 3

 
 
 
 
GO TO
 
GROUP HEADER SECTION right click select section expert then SUPPRESS(NODRILLDOWN) X+2 enter the following
 
GroupName ({GRP.level_col})='OTHERS' AND {GRP.label}="Label level 2"
 
This will display
 
 
 

ABC                        Label level 1

                        ABC                 2.00                        Label level 2

                        ABC                 3.00                        Label Level 3

 
Then go to details section and delete the field details for ABC and level cols
 
 
now the display is as you want it
 

ABC  Label level 1

                         Label level 2

                         Label Level 3
 
to get D: you can use a textbox in details section and type D: in it same for GH: will need to place text box in Group Header Section.....
 
Cheers
Rahul


Edited by rahulwalawalkar - 12 Feb 2008 at 1:47am
IP IP Logged
APS_LSWE
Newbie
Newbie


Joined: 11 Feb 2008
Location: Romania
Online Status: Offline
Posts: 3
Quote APS_LSWE Replybullet Posted: 14 Feb 2008 at 5:46am
Unfortunately a condition such as this:

GroupName ({GRP.level_col})='OTHERS' AND {GRP.label}="Label level 2"

won't work, because the label can be anything, the code can be anything, the level can be anything... you cannot hardcode the values in your conditions!

Also this: "then in Named Group enter the name GH :abc " sounds like a bit of hardcoding to me. "abc" is a dynamic value in a database.

And thirdly, i made a little mistake in my presentation: level is varchar (with the same value range : 1 to 10).

PS: "GH" stands for "Group header", "D" stands for "Details", i did not actually want to put these into text boxes :)


Edited by APS_LSWE - 14 Feb 2008 at 5:51am
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