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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic columns 1

Status
Not open for further replies.

052780

Programmer
Nov 5, 2007
17
0
0
PH
I have a report that will have to suppress columns depending on parameters. The problem is it can be n combinations/variations.

For example, it is possible that user wants to generate report containing column1:region; column2:country;column3:city

Then another user, wants to display:
column1:city;column2:country;column3:region

Can someone advise what is the efficient way of solving this?

Thanks!
 
You might manage it with different detail lines, suppressing the variants you don't want. Or subreports in the report header or footer, again with unwanted sections suppressed so that the subreport does not run.

I don't think there's a better way. Crosstable vary their columns, but that is for variable values of a single value.

It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
For the example you gave there is one possible solution:

Create 3 parameters - Give each 3 possible selections:

{?parameter1)
// prompt text to read 'Select data for 1st column'
City
Country
Region
{?Parameter2}
// prompt text to read 'Select data for 1st column'
City
Country
Region
{?Parameter3}
// prompt text to read 'Select data for 1st column'
City
Country
Region

Then in the report place all 3 possible fields in the first column. then conditionally suppress the fields based on the parameter selections.

So for example, if using a string selection for the parameters then your suppression for city in column one could be:

{?parameter1} <> 'City'

same for region:

{?parameter1} <> 'Region'


It is a very kludgy approach but would work to display the data in the order they prefer within the report.

If there is always a specific pattern as to whom wants which order (for example one dept. always has (City/region/country} and another always has {Region/country/city} then you could always simplify the parameter selection by asking them to select only which dept they are from and then suppressing / displaying the data accordingly using the same method as above.

'J
 
Thanks for the responses ",) I'm using version 11 and recently also testing the approach of editing the report at runtime using RAS.
 
thread149-655589 might be helpful.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top