Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: virtual groups Post Reply Post New Topic
Author Message
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Topic: virtual groups
    Posted: 27 Feb 2007 at 6:39pm
Hi,
 
I have a single group that has various names which serve as subgroups, though they are really not subgroups in the report, just differerent names.
(make sense?Confused)
 
For example, the group includes: "Infrastructure Services", "IS-Team", "IS-PAT". The rows starting with IS serve as subgroups to Infra~ Services, even though they are in reality equal elements of the same group.
 
How can I sum these as below:
 
 
 
 
if GroupName ({ResourceUsageReport.OrganizationName}) = "Infrastructure Services"
then
    // sum group above that begins with "IS"
 
else if GroupName ({ResourceUsageReport.OrganizationName}) = "Managed Services"
then
     // sum group above that begins with "MS"
else if GroupName ({ResourceUsageReport.OrganizationName}) = "Management Consulting"
then
    //  sum group above that begins with "MC"

else
    // sum
 
 
Hope this makes sense. Thanks very much for any ideas on this.
 
Ant
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Feb 2007 at 7:47pm
I would create a global variable for each group sum you want to track. Then insert these variables into the proper place in the formula you listed above.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Posted: 27 Feb 2007 at 8:49pm
Thanks for your answer. I'm still unsure as to how what I would use to create the values for the global variables with.
 
I need to somehow determine which 'group' i.e the organizationName & its associated value I will be summing. By looking at the code I pasted, can you see how this could be done?
 
Basically what I want to do in "very" pseudo code is:
 
 
if GroupName ({ResourceUsageReport.OrganizationName}) = "Infrastructure Services"
then
sum ({ResourceUsageReport.OrganizationName})  only those who's Len(({ResourceUsageReport.OrganizationName}),2) = "IS"
 
else
 
 
if GroupName ({ResourceUsageReport.OrganizationName}) = "Managed Services"
then
sum ({ResourceUsageReport.OrganizationName})  only those who's Len(({ResourceUsageReport.OrganizationName}),2) = "MS"
 
 
Basically, I don't have a clue how to do thisConfused
 
Thanks for any ideas on this
 
Ant


Edited by TokyoAnt - 27 Feb 2007 at 9:07pm
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Feb 2007 at 10:21pm
Ok, I don't have time to write the report, but here is some more pseudo-code that should get you in the right direction.


Global NumberVar ISSum
Global NumberVar MSSum
if GroupName ({ResourceUsageReport.OrganizationName}) = "Infrastructure Services" and Len(({ResourceUsageReport.OrganizationName}),2) = "IS"
then
ISSum = ISSum + {ResourceUsageReport.OrganizationName}
else
if GroupName ({ResourceUsageReport.OrganizationName}) = "Managed Services" and Len(({ResourceUsageReport.OrganizationName}),2) = "MS" then
MSSum = MSSum + {ResourceUsageReport.OrganizationName}

Hmm.. for some reason the spacing is all screwed up, but its readable.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Posted: 01 Mar 2007 at 8:07pm
Hi Brian, Thanks for the input. I'm an absolute beginner to reports & there must be something fundamental about reports & perhaps their evaluation time that I'm missing.
 
What I need is to sum all the rows (they are average values) with group names starting with IS & place this value in the row with the  group name "Infrastructure Services". etc.
I tried applying what you recommended above but all group rows returned a value of 0.
 
Below is the code. (I assumed you meant Left when you used Len in your example):
 
Global NumberVar ISSum1;
Global NumberVar MSSum1;
Global NumberVar MCSum1;
 
 
// For the groupheader valued "Infrastructure"

if GroupName ({ResourceUsageReport.OrganizationName}) = "Infrastructure Services"
then 
 
// Sum all group headers that start with "IS"

    if Left(({ResourceUsageReport.OrganizationName}),2) = "IS"
    then
        ISSum1 := ISSum1  + ( Sum ({ResourceUsageReport.Period1}, {ResourceUsageReport.OrganizationName})
        / sum({@AvailWkHrs1},{ResourceUsageReport.OrganizationName})*100 )
   
 
for the groupheader valued "Manged Services"

else if GroupName ({ResourceUsageReport.OrganizationName}) = "Managed Services"
then
 
// Sum all groupheaders that start with value  "MS"

    if Left(({ResourceUsageReport.OrganizationName}),2) = "MS"
    then
        MSSum1 := MSSum1 + (Sum ({ResourceUsageReport.Period1}, {ResourceUsageReport.OrganizationName})
 
// All groups starting with IS, MS etc (i.e. Not named  "Infratructure Services" or "Managed Services")

else
    Sum ({ResourceUsageReport.Period1}, {ResourceUsageReport.OrganizationName})
    / sum({@AvailWkHrs1},{ResourceUsageReport.OrganizationName})*100
 
 
* Currently I'm just summing them for test purposes. They will need to be averages but this is not an issue so disregard that. I'm just after *placement* of values at the moment.
 
Thank you very much for any assistance you can give on this.
 
Regards
 
Ant
 

IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.