Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Creating A Formula To Create Groups Post Reply Post New Topic
Author Message
AdamA
Newbie
Newbie
Avatar

Joined: 15 Dec 2009
Location: United States
Online Status: Offline
Posts: 8
Quote AdamA Replybullet Topic: Creating A Formula To Create Groups
    Posted: 15 Dec 2009 at 1:31pm
Ok, this one sounds pretty simple, but has proven itself to be trickier than I thought.
 
I have 4 subreports in Details A-D with no database connected for the main report (using it only as a container).  I need to have the Group Tree created, so a user can easily navigate to the beginning of each subreport (as I would conditionally suppress the Details Section/subreport when it did not match the appropriate Group Name).
 
So in essence, I'm looking to display things in the following manner --
 
GROUP NAME 01
--------
SubReport 01
===================
GROUP NAME 02
--------
SubReport 02
===================
etc
 
with a Group Tree indicating each Group
 
The catch being, there are no fields to base a formula on in the main report.
 
I've tried the following formula (which, while valid, is not selectable for the Group By function):
 
StringVar ReportName;
NumberVar X;
For X:= 1 to 4 Step 1 do
(If X = 1 Then "Group 01"
Else If X = 2 Then "Group 02"
Else If X = 3 Then "Group 03"
Else If X = 4 Then "Group 04");
 
Any assistance would be greatly appreciated   :)
 
Thank you!
 
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 16 Dec 2009 at 6:14am
without a field in the main report, no grouping is possible.  CR cannot determine before the report is rendered what data goes in what group.
 
Data for grouping must exist in the data. It might be a manipulation or a simple calculation, but all of pieces of the group criteria must exist/be deterministic before the report is rendered.  Subreports don't 'exist' prior to rendering. This is what I have figured out by playing with CR and trying out various dynamic grouping formulas.
 
just as a last note: why do you have ReportName in the above snippet, it is not used?
 
HTH
IP IP Logged
AdamA
Newbie
Newbie
Avatar

Joined: 15 Dec 2009
Location: United States
Online Status: Offline
Posts: 8
Quote AdamA Replybullet Posted: 16 Dec 2009 at 6:28am
The subreports are just separate stand-alone reports, no connection to each other or the main report, they just need to be run together.  I know this is possible, as I have done it before, but that was years ago - I am now at another company and don't have access to my prior work.
 
I am certain that one can create a formula to group on without using a field.
 
IP IP Logged
AdamA
Newbie
Newbie
Avatar

Joined: 15 Dec 2009
Location: United States
Online Status: Offline
Posts: 8
Quote AdamA Replybullet Posted: 17 Dec 2009 at 2:23pm
I guess I should have specified more clearly that there is no data in the main report (and no database associated with it either) - I can associate the main database that is used for the 4 subreports with the main report, but there is no field linking to any of the subreports, and there is no field in the database that will define the grouping I am looking to get - it has to be done on a formula without using a field.
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.