Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Group sorting based on parameter selection Post Reply Post New Topic
Author Message
kemigirl
Newbie
Newbie


Joined: 05 May 2009
Online Status: Offline
Posts: 14
Quote kemigirl Replybullet Topic: Group sorting based on parameter selection
     Posted: 19 Jun 2009 at 2:27pm
Here's my situation:

a) We publish reports using Business Objectives, which allows our reports to be scheduled.  My report will "update" once a month and then users can go to the portal and download the most recent version of the report at any time.  The report itself cannot be updated by a user "on demand".

b) Currently I have a 2 different versions of one report.  They are identical in format and the formulas are the same.  The only difference is that one report calculates off of employee headcount (actual number of people), and the other report calculates off of FTE's, which is a number assigned to each person that determines how many hours they work a week.  So we can have 2 people who are part-timers...their numbers would look like this:
    headcount = 2
    FTE count = 1.6

I have combined these two reports into one and used a parameter for the user to select whether they want the headcount or FTE count report.  Since the report is a scheduled one (and not on demand), I decided to put all of the formulas on the report.  This means that when the report is updated once a month, all of the info I would ever show, is updated and calculated.  Then the user picks what they want to see, and the report suppresses certain sections to show/not show the appropriate sections.  This actually works beautifully.  The report is scheduled and the user can see the version they want without the report having to go back to the databases to update.

My problem?  Sorting.  I have 4 groups in my report.  I want group 1 to sort by formula 1 (based off headcount) if the user picks parameter 1.  Otherwise, I want group 1 to sort by formula 2 (based off FTE) if they pick parameter 2.

I have tried using the group sort expert but the fields I want to sort by don't show up in the drop-down.

Any ideas of how to get it to do this???  My goal is for the sorting to happen without having to hit the database again...for the sorting to happen with the information that is already in the report.

Any help / tips are greatly appreciated!! Smile
 
IP IP Logged
AdamField
Groupie
Groupie


Joined: 04 Jun 2009
Online Status: Offline
Posts: 88
Quote AdamField Replybullet Posted: 22 Jun 2009 at 1:56am
Hey Kemigirl,
 
I think you can solve this by placing the parameter into a formula with a IF THEN ELSE arround it
IF {parameter = headcount}
THEN  info needed when working with parameter
ELSE  FTE info
 
You can group on this formula field then
 
Repeat this for every value that can change depending on what parameter you selected.
 
Hope this helps
 
Greetings
 
Tom
IP IP Logged
kemigirl
Newbie
Newbie


Joined: 05 May 2009
Online Status: Offline
Posts: 14
Quote kemigirl Replybullet Posted: 22 Jun 2009 at 10:10am
Tom, I think I already have a formula set up like this for each of the values that change with the parameter:

i.e.:

If {?Show FTE or Headcount}="Assigned FTE" Then
    {@Month1_TotalHires_FTE}
Else
    {@Month1_TotalHires_Count}


This works fine, where the right numbers show up upon selecting a parameter, but I can't figure out how to make it sort depending on parameter.  This particular formula does not show up on the group sort expert, which is where I thought I would see it.

Are you suggesting writing an actual sort formula?  I've never done that (I'm new) and could use some help with syntax as well as formula placement.
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