Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Al Klapperich
  Where is Al Klapperich?
 Ripon, WI
 Wisconsin - United States
 Al Klapperich
 To: Jamie Osborn
  Where is Jamie Osborn?
 Melbourne
 Australia
 Jamie Osborn
 Tags
Subject: RE: user selectable subtotals in report form
Thread ID: 21679 Message ID: 21781 # Views: 2 # Ratings: 0
Version: Visual FoxPro 6 Category: Reports and Printers
Date: Tuesday, April 01, 2003 5:06:29 PM         
   


> > > I need to allow user to select which column they want subtotaled...is there a way to change the grouping expression in report form before report form is called? I have found the records in the report form (objtype = 9 and objcode = 3, in EXPR field) where field name is placed. I suspected I'd have to modifiy those records?
> > >
> > > Thanks,
> > > Al
> >
> > You could do it that way but why not have one field in your result cursor that you always group on and modify your select statement to use that field.
> > eg.
> >
> > DO CASE
> > 	CASE nGroup = 1
> > 		lcGroup = "Sex"
> > 	CASE nGroup = 2
> > 		lcGroup = "Weight"
> > 	&& etc. etc.
> > ENDCASE
> > 
> > SELECT Name, ;
> >             Address, ;
> >             Age, ;
> >             Sex, ;
> >             Weight ;
> > FROM Person ;
> > ORDER BY &lcGroup ;
> > INTO CURSOR MyResultCursor
> > 

> > Cheers,
> > Jamie
> > jamie.osborn@foxite.com
>
> Whoops - should have been :
>
>  SELECT Name, ;
>              Address, ;
>              Age, ;
>              Sex, ;
>              Weight, ;
>              &lcGroup as MyGroup ;
>  FROM Person ;
>  ORDER BY &lcGroup ;
>  INTO CURSOR MyResultCursor
> 

> I got interupted and hit send without thinking !!!!!!
>
> Cheers,
> Jamie
> jamie.osborn@foxite.com


Jamie,

Maybe I missing what you're trying to tell me...I think I've got the selection/grouping process figured out. It's when I call the report form and want to print subtotals for each group. As I understand the report forms - you have to set up an expression in the Data Grouping section in order to print out subtotals. In my app the user could want 1, 2 or maybe 3 different subtotals - it's whatever the user wants. The way I'm doing it now is to have 3 sep. report forms, each w/ a differerent # of subtotals lines (1, 2 or 3). So if the user wants 2 subtotals - I will use the report form that has 2 subtotal lines in it...if they only need 1 subtotal - I use the report form w/ 1 subtotal line. I put an eval(grp1) statment for the group expression - so then I can set grp1 = "Myresultcursor.sex" before I call the report form.

I was hoping there was a way to have just 1 report form to handle the variable number of subtotals...I don't think there is.

Thanks,
Al

COMPLETE THREAD

user selectable subtotals in report form Posted by Al Klapperich @ 3/28/2003 8:34:42 PM
RE: user selectable subtotals in report form Posted by Jamie Osborn @ 3/31/2003 1:24:40 AM
RE: user selectable subtotals in report form Posted by Jamie Osborn @ 3/31/2003 1:26:58 AM
RE: user selectable subtotals in report form Posted by Al Klapperich @ 4/1/2003 5:06:29 PM