Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling the change group expert command using formula?

Status
Not open for further replies.

lisze

Programmer
Mar 17, 2002
10
JP
Hi,

I'm only a beginner and is now using CR8.5 but creating report for CRv7. I have 2 groups in the report, A and B. There is a parameter to control which group to show when the report is run.

When A is shown, I want the the results to group by "Name" first whereas when B is shown, I want the results to group by date first.

Currently, the change group expert command groups the report according to the order from top to bottom and I have set the order to group by "Name" first. So A turns out fine in this case, but when B is shown, it will still be grouped by "Name" first which is not what I want:

Current output for A:
Peter 17-March-02
18-March-02
John 17-March-02
18-March-02
:
Required output for A:
17-March-02
18-March-02
:

Is there a variable that I can use like:
If (A) then group_expert_command = groups "Name" first
else if (B) then group_expert_command = groups "Date" first

Or does anyone have a better solution?

Thanks,
LS
 
Use a parameter field with default values of "By Date" and "By Name", then create a formula field based on the parameter as follows:

If {?Parm}="By Name" then {Name} else {date}

Then group by this formula fireld. One will group by date and one by name. Software Support for Macola, Crystal Reports and Goldmine
dgillz@juno.com
 
Don't forget that an If-Then can't be:

then -string-
else -date-

You will have to convert the date to character, and make sure that it still sorts as a date (yyyy-MM-dd). Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Thanks! But the funny thing is I am unable to group by the new formula field for group A...the OK button is disabled no matter what I changed in the "Change Group Options" box. Is this caused by formulas in my report?
 
Got it, I just combined them together as one group.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top