Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: CR X/XI - Reorder Hierarchy Group @ Run-Time Post Reply Post New Topic
Author Message
nld09
Newbie
Newbie


Joined: 01 Jul 2009
Online Status: Offline
Posts: 2
Quote nld09 Replybullet Topic: CR X/XI - Reorder Hierarchy Group @ Run-Time
     Posted: 01 Jul 2009 at 12:04pm
I have been searching for hours on this issue but could not find a solution for it. 

Here is my problem:
I have group 1) Staff-ID, 2)Branch-ID, and 3)Cust-ID (it's in this order in the group expert).

If I selected the group 1 option, then it would be correct.  However, if I selected group 2 option, and the condition would suppress group 1/3, but the report is still group by group 1.

Am I doing something wrong or is there a work around for it?

Thank you for reading it and hopefully you can give me some helps.


Edited by nld09 - 01 Jul 2009 at 12:25pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Jul 2009 at 1:09pm

Are you trying to use a run time parameter to change the group order?

If so you will want to create 2 formula fields and use them to group on. The formulas will change the data absed on the parameter selection.
For example you have a numeric parameter 1 or 2.
1 means group by Staff ID, Branch ID, Cust ID
2 Means group by Branch ID, Staff ID, Cust ID.
Formula one is for group one.
If {?parameter1} =1 then {table.StaffField} else {Table.Branchfield}
Formula Two is for group two.
If {?parameter1} =1 then {table.Branchfield} else {Table.StaffField}
This way the group field (formulas) will invert when the paramter changes.
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 01 Jul 2009 at 1:38pm
It sounds like you only want to have 1 grouping but it would be variable, or you have multiple groupings and you want them to change order when a the 'top' level is changed...hopefully one of these is correct.
 
DBlank is right, first have your parameter of how you want to group (it could be the top group and the rest is dictated off of that).  Once the user has selected a value for the parameter, it's time for ...formulas...
 
Now depending on if this one group that is affected or all three depends on the number of formulas you need to make. It is basically 1 formula per level of grouping you want to change.
 
the formulas are pretty basic, something like:
if {?parameter} = x then
 {table.fieldx}
else
 if {?parameter} = y then
  {table.fieldy}
 else
  {table.fieldz}
 
could continue.  again, make one formula for group you want to be dynamic, cut and paste works for me, just change the {table.field} around to be correct for the group.
 
Last, go to the group, right click and select change group, now instead of the {table.field} that is there, select the correct formula.
 
Thanks to Brian for this, it has been a boon to my report writing.
 
HTH
IP IP Logged
nld09
Newbie
Newbie


Joined: 01 Jul 2009
Online Status: Offline
Posts: 2
Quote nld09 Replybullet Posted: 02 Jul 2009 at 9:11am
Thanks DBlank and lockwelle.  I am going to test it out.

NLD09
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