Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: count and creating sub group Post Reply Post New Topic
Author Message
vdominick
Newbie
Newbie


Joined: 16 Sep 2012
Online Status: Offline
Posts: 2
Quote vdominick Replybullet Topic: count and creating sub group
     Posted: 17 Sep 2012 at 12:08am
hey,
I'm new at crystal reports but have some programming experiance.
i have the following data
VC_JET_GROUP1_ACCOUNT1
   Active
       Jos  
       Koen
       Hannes
   Standby
       Veronique
 
VC_JET_GROUP1_ACCOUNT2
   Active
        Test
        Test 2
   Standby
        Test 3
        Test 4
        Test 5
 
VC_JET_GROUP2_ACCOUNT3
    Active
       Test 6
       Test 7
    Standby
       Test 8
......
 
i want to create a group selection so every group is put together with
   VC_JET_GROUP1* and as subgroups Account1 and Account 2
 
and if you see a total of the group how many people are standby and active
VC_JET_GROUP1
   VC_JET_GROUP1_ACCOUNT1   Active: 3    Standby: 1
   VC_JET_GROUP1_ACCOUNT2  Active: 2     Standby: 3
VC_JET_GROUP2
    VC_JET_GROUP2_ACCOUNT3 Active:2      Standby: 1
.....
 
is this possible to see the above with the mentioned data??
 
dominick
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 17 Sep 2012 at 4:03am
There are two ways of doing this:
 
1.  Create 2 formulas - one for Active and one for Standby.  They'll have this type of format:
 
if {MyTable.PassengerType} = "Active" then 1 else 0
 
or
 
if {MyTable.PassengerType} = "Standby" then 1 else 0
 
Sum these formulas at the group level to get your counts - they can be put in either group headers or group footers.
 
2.  Use running totals. 
Field to Summarize:  Some unique field in the record
Summary: Count
Evaluate On: Every Record
Reset On:  Change of group and select your account group.
 
Running total values only work if you put them in group footers.
 
-Dell
IP IP Logged
vdominick
Newbie
Newbie


Joined: 16 Sep 2012
Online Status: Offline
Posts: 2
Quote vdominick Replybullet Posted: 17 Sep 2012 at 8:42pm
i found how to add my totals.
1. in the group header make a hidden forumala and declare a shared numbervar and place the variables on 0
2. in the detail make a hidden forumula and declare a shared numbervar and count if {MyTable.PassengerType} = "Active" then iActive := iActive +1
3. in the group footer make a visable forumala and declare a shared numbervar and show iActive
 
 
can anyboy tell me how to make a group like
vc_JET_group1
   vc_jet_group1_user1
   vc_jet_group1_user2
 
can you cut strings from a field like trim till the 3 "_" sign???
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 17 Sep 2012 at 11:41pm
Hi

Easy way of displaying groups in indentation fashion is to add spaces to each group level.

 

Space(5)&{Group1Name}  or right click on string field – Format Field—Paragraphs – Indentation

 

Yes, in crystal just look for

 

Instr() function

 

Thanks,
Sastry
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 18 Sep 2012 at 3:53am
If you're looking for how to get the string for the first group level, I would do something like this (assuming that the underscore '_' character defines the sections of the name):
 
left({MyTable.Account}, length({MyTable.Account}) - InStrRev({MyTable.Account}, '_'))
 
-Dell
 
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