Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Godzilla Mozilla
  Where is Godzilla Mozilla?
 Kaduna
 Nigeria
 Godzilla Mozilla
 To: Bernard Bout
  Where is Bernard Bout?
 Brisbane
 Australia
 Bernard Bout
 Tags
Subject: RE: Report Column Headers
Thread ID: 104289 Message ID: 104653 # Views: 1 # Ratings: 0
Version: Visual FoxPro 8 Category: Reports and Printers
Date: Friday, August 18, 2006 7:06:26 PM         
   


Jim and Bernard thanks for your help!

Godzilla


> > Here is the description of my table
> >
> > Year Month Values
> > 1951 January 319
> > 1951 February 898
> > 1951 March 765
> > 1951 April 654
> > 1951 May 343
> > 1951 June 768
> > 1951 July 900
> > 1951 August 766
> > 1951 September 765
> > 1951 October 898
> > 1951 November 876
> > 1951 December 321
> > 1952 January 319
> > 1952 February 898
> > 1952 March 765
> > 1952 April 654
> > 1952 May 343
> > 1952 June 768
> > 1952 July 900
> > 1952 August 766
> > 1952 September 765
> > 1952 October 898
> > 1952 November 876
> > 1952 December 321
> > 1953 January 319
> > 1953 February 898
> > 1953 March 765
> > 1953 April 654
> > 1953 May 343
> > 1953 June 768
> > 1953 July 900
> > 1953 August 766
> > 1953 September 765
> > 1953 October 898
> > 1953 November 876
> > 1953 December 321
> > .
> > .
> > .
> > .
> > .
> >
> > Another layout of the table is that, Month is the first column and the Year column the second.
> >
> > The number of clumns is not known in advance, as the years would determine that.
> >
> > Godzilla
> >
> >
> > > > Dear Experts,
> > > >
> > > > I need to display a report based on the outcome of cross tabbing a table, my problem here is that, how can I generate the Column headers for the report since I don't know them in advance?
> > > >
> > > > Godzilla

> > >
> > >
> > >
> > > One way is you can use a "Field" object instead of a "Label" object for your headers.Then just enter the expression in each one:
> > >
> > > FIELD(1) FIELD(2) FIELD(3) etc.
> > >
> > > When run the expression will be evaluated and whatever you have as field names will appear in the "Field" object.

>
>
> Which is why I said to use the FIELD() function. The FIELD() function is a function in VFP:
>
>
> Returns the name of a field, referenced by number, in a table.
>
> FIELD(nFieldNumber | cFieldName [, nWorkArea | cTableAlias [, nFlags]])

>
>
> So once you make a cross tab of your table your table will have field names which you don't know at design time. So you dont use a label on your report and use instead a fieldobject, setting its values to FIELD(1), FIELD(2) etc.
>
>
>
>
> When you run the report the expression FIELD(1) will be evaluated and will display the current field name. See the image below.
>
>
>


ENTIRE THREAD

Report Column Headers Posted by Godzilla Mozilla @ 8/14/2006 5:41:17 PM
RE: Report Column Headers Posted by Jim Winter @ 8/14/2006 6:15:26 PM
RE: Report Column Headers Posted by Bernard Bout @ 8/15/2006 7:56:52 AM
RE: Report Column Headers Posted by Godzilla Mozilla @ 8/16/2006 12:31:08 PM
RE: Report Column Headers Posted by Jim Winter @ 8/16/2006 2:22:56 PM
RE: Report Column Headers Posted by Bernard Bout @ 8/17/2006 7:08:43 AM
RE: Report Column Headers Posted by Godzilla Mozilla @ 8/18/2006 7:06:26 PM