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!

Field substitution in reports

Status
Not open for further replies.

Thmemuar

Programmer
Sep 23, 2002
8
CA
I have a table that contains 5 fields whose values are determined by the user, and which are subsequently to be used as column headers (for example, Widgets, Gizmos, Doodads, Thingies and Watzits).

A second table holds records containing a date and sales info about each of the 5 fields in the first table (for example, 02/07/21 - 15 - 47 - 33 - 73 - 11).

I want to design a report, in advance, so it will always look the same. But I want the user to be able to select any two fields in the first table, on which to base that report (for example, "Show me by date, the sales of Widgets versus Gizmos").

Because Widgets and Gizmos must serve as the colum headers in the report (and may in fact be *any* two of the 5 fields), and because their corresponding values in the 2nd table will also be unknown until the user's selectin is made, I can't know in advance what either will be. I have to be able to use some kind of substitution in the report for the Header and Detail sections.

Can anyone tell me if that's possible?

Thanks.
 
It's possible. Design the report using text boxes for the header with a value of say m.cHeader1 and m.cHeader2. Then save off the value of the field before running the report:

m.cHeader1 = whatever
m.cHeader2 = whatever

REPORT FORM MyReport ;
FOR TableField = m.cHeader1 ;
AND TableField = m.cHeader2

Or whatever the scenario is.
Dave S.
 
Thmemuar

You could use 5 labels stacked one on top of the other and use the printWhen clause in the label. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
in the report for the row headers, make them a varible that can be set to the label
clabel1 = 'Doodads' && you get the idea

for the detail band with the data, make them refer to any name you like that will be consistant with the select statement you are to create.

csqlsel = [select ] + anyfieldname+ [as field1, ] + nextfieldname [ as field2 from mytable into cursor mycursor

&csqlsel

the report will have the data environemnt set to the cursor (mycursor) and fields (detail band databox) in the select statement. once the users selects the fields and options you build the select statement. test for a result with _tally, then run the report. since the report is always looking for the named cursor and fields labled with the AS, should be no problem.
Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top