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!

Grouping/sorting based on parameter

Status
Not open for further replies.

goldyr

Programmer
May 26, 2003
25
SE
I hope you can help me with this.
1. I want to group or sort the records based on which parameter I use.
2. If I don't enter anything in a parameter I want the report to choose ALL records so I don't have to enter ALL parameters when I open the report.

Is this possible?
Thanks.
/E
 
I've done something similar in Crystal 8.5. I defined a formula field to use different record fields, depending on parameter. Or else space when I wanted no sorting.

The limit you'll find is that you have to use record fields, or simple derivatives. Not values like running totals, that are worked out after the groups are determined.

Madawc Williams
East Anglia, Great Britain
 
Let us address the last item first

2. If I don't enter anything in a parameter I want the report to choose ALL records so I don't have to enter ALL parameters when I open the report.

you must have a parameter value assigned or Crystal will ask for one. All you do here is give the created parameter a default value of "ALL"...then only the user won't have to enter this value....although they will be given the opportunity to change it when the report is run.

in the record selection formula you would have something like this

if {?Parm} = "ALL" then
true
else if {?Parm} = {table.someField} then
true
else
False;

1. I want to group or sort the records based on which parameter I use.

Here you create a formula that you would create a group on.

//@Group1

if {?ParmGrouping} = "Something" then
{Table.StringField}
else if {?ParmGrouping} = "Somethingelse" then
totext({Table.NumericField})
else
{Table.DefaultStringField};

NOTE: I converted a numeric field to a string...If the field was a date this would be necessary as well since all results of an IF-Then block must be the same datatype.

You can create a second group formula as well it completely manage your sorting/grouping

eg. Let us say you wanted to group by {Table.StringField}/totext({Table.NumericField}) or totext({Table.NumericField})/{Table.StringField} depending on the value of the Parameter.

Hope this helps


Jim Broadbent
 
Thanks a lot. I think this will work.
/E
 
Hmm...
I have 16 parameters with from - to values. It will be many If...
Is there any other way to do this or do I have to use some other function, like OLAP-cube for example.
Please help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top