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

How to use variables, instead of field names, to sort and subtotal?

Status
Not open for further replies.

montypython1

Technical User
Jan 12, 2005
187
US
Greetings,

How would I use variables, instead of field names, to sort and subtotal information on a report?

I have 6 reports that are almost identical, except that they are sorted and subtotalled differently. Each report has the same 3 fields (Manager, Dealership, NewUsed) in the "Data Grouping" property of the report. Each report sequences these 3 fields differently, such as:
In report #1 the data are sorted and subtotalled in the following sequence: Manager, Dealership, NewUsed.
In report #2 the data are sorted and subtotalled in the following sequence: Dealership, NewUsed, Manager.
In report #3 the data are sorted and subtotalled in the following sequence: NewUsed, Manager, Dealership.
In report #4 the data are sorted and subtotalled in the following sequence: Dealership, Manager, NewUsed.
In report #5 the data are sorted and subtotalled in the following sequence: Manager, NewUsed, Dealership.
In report #6 the data are sorted and subtotalled in the following sequence: NewUsed, Dealership, Manager.

From a maintenance standpoint, this is cumbersome when I have to modify the same basic report 6 times.

Any suggestions will be greatly appreciated.

Thanks,
Dave Higgins
 
Dave,
Prepare a cursor before printing. That cursor must have 3 fields Group1, Group2, Group3.
Then just replace that Group1..3 with the values of that fields you want.
That way you will have only one report. Grouped by
Group1
Group2
Group3


Borislav Borissov
 

Dave,

I agree with Borislav. For this kind of problem, it's usually best to do the difficult stuff before you get to the report. Concentrate on creating a cursor that reflects the grouping, summaries, ordering, filtering, etc. that you want. That leaves the report to focus on what it's good at -- layout, fonts, etc.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Boris and Mike,

Thank you both for your suggestions .... I wish I would have talked with you both before building the original set of reports (of course, I made it more difficult than it needed to be).

I will implement your suggestions and let you know how it turned out.

Thanks again.
Dave Higgins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top