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

HELP !!!! - COMPLEX REPORTING...

Status
Not open for further replies.

venado

Programmer
Nov 28, 2000
35
CA
DOES ANYONE HAS A SAMPLE REPORT DONE IN VFPRO. MORE SPECFIC, I NEED TO KNOW HOW TO WRITE A COMPLEX REPORT FORM. THIS REPORT WILL BRING THE DATA FROM MANY TABLES, INFORMATION WILL BE PRINTED ACCORDING TO SOME CONDITIONS MET AND THE INFORMATION PRINTED WILL BE MANY LINES PER RECORD, AND SO ON.

I NEED SOME GUIDENCE ABOUT WRITING THIS KIND OF REPORT FORM IN VFP.

THANKS,
 
As a general rule, the problem is not in creating the report but in assembling the data that is to go into the report. It sounds like at a minimum you are going to want at least one level of grouping in your report (i.e. "By States") if not more ("By States, By County").

Construct a SELECT statement that gets all of the information from the various tables into one table or cursor. Use the 'order by' part of the select statement to arrange the records in the sequence that they should appear in the report. Once you've got your data all in one place, it should be a fairly straigtforward process to design the FRX to generate the desired output. In the FRX there are some tricks you can play using the 'print when' and 'delete line when blank' that will enhance your final product.

I hope this helps.

Steve
 
Another method, if all of tables are related, is to do a single query to get your selection set, relate that to each of the tables, then, in the report ytou can reference then in "." notation -- You can include functions with the data (even udfs -- if you rememeber to add the "set procedure to" stratement in the init code of the data environment)

- with this method, you don't put any data actually in the data environment, and you can easliy change your selection set by just altering your looping query!

-- if not all of the tables are related, you can use udf's to locate specific info -- just remember to a) start your udf with saving your old work area, b)checking for new work area c) closing the new work area if necessary and d) -- ost reimportant restoring the work area

As always in VFP, there's more than one way to accomplish a job!


Here's a sample udf:
*************************
FUNCTION FindArea
*************************
LPARA pstrArea
intHoldArea = select()
* if table not open, open it in new work area
IF !used('AreaTable')
USE AreaTable order AreaKey in 0
ENDIF
retValue = ''

IF seek(allt(pstrArea),'AreaTable')
retValue = allt(AreaTable.AreaName)
ENDIF

SELE (intHoldArea)

RETURN retValue
 
Your problem is not outputing data with a report file but is to gather them somehow. I have a ideea. Reports aloow U to specify if a field is in the report from a table or another so U can define them as myTable.field1 or myAnotherTable.field1. If can also perfom a somekind of report validation with "Print When" and U can also can calculate fields "See report help". If U chose to leave the report clean then U can use a complex SQL statament wich will bring all data U need into a single cursor table. I belive is the fastest way for outputting data . Have fun and if U like help please fell free to e-mail me (nosferatu2000@k.ro) for futher discution.
 
And ... if worst comes to worst ... you can create a file to hold the finalized report data ... consisting of fields like line1 c(80), line2 c(80), line3 c(80), ... for as many lines (maximum) as each record could need and actually form the report within the file and then have the report form just spit them back out onto the paper.

Now, be aware that formatting becomes a problem when you do this sort of thing because each character does not take up the same amount of space. What you may have to do is have fields for different columns positions on the paper and you may not use all fields for each record depending upon a multitude of factors.

It can get complicated but is possible because I have done it. This is sort of a last resort method. Good luck.

Don
dond@csrinc.com

 
The best way to get going with a difficult report is to start it in the Report Wizard. Do a small sample report based on one table. Then modify the report and look at the how the bands are grouped. Play with adding variables and different types of bands.

Carla Fair-Wright
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top