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

Wide reports

Status
Not open for further replies.

MikeFreeland

Programmer
Sep 4, 2000
10
0
0
I have a large number of 1-table reports, all wide, consisting of an item, then a variable number of columns of numbers, each column representing a datum for the item for the year at the top of the column, like so:

Page 1a
Item 1990 1991 1992...
------------------------------------
Item1 90dat1 91dat1 92dat1...
Item2 90dat2 91dat2 92dat2...

until the page is filled. Now, I want the report to know that it hasn't printed all of the data for ietms 1 and 2, and go to the top of the data and start all over with item 1, but printing the columns where it left off. It should look like this:

Page 1b
Item 1993 1994 1995...
------------------------------------
Item1 93dat1 94dat1 95dat1...
Item2 93dat2 94dat2 95dat2...

Page 2a would start with item3 and so on to eof.

I am now doing it by multiple calls to the FRX. Problem here is that the pages emerge 1a, 2a, 3a, and then on the second call 1b, 2b, 3b etc. and the user has to collate. It's not very elegant and the second call of course calls up the preview a second or third time (at the user's choice).

What I'm looking for is a sort of "do while" loop in the report, and I haven't figured a way to hack the FRX to plug in the required parameters (record numbers, columns and sub-pages etc.) The data grouping, sorting and other elements of these reports are complex, so fiddling with the source data file is not an option.

Your assistance will be most appreciated. Thanks to all.

Mike [sig][/sig]
 
somewhere on your system (probably C:\Program Files\Microsoft Visual Studio\Vfp98\Filespec) there are some examples of what I think you want to do, i.e. there are 2 reports, 60frx1.frx and 60frx2.frx. you maight want to run those and see if they are a good example for you, then check out the report and see if it has what you are looking for in it. Good Luck! [sig][/sig]
 
Ooooh. Thanks. I'll look into that & letcha know.

Mike [sig][/sig]
 
Mike, try to organize following. I never tried it, its only my suggestion, but hope it will work.
1. Make additional empty record at the end of you report cursor. Make 'print when' for controls in report so they will not be printed for that empty record.
2. Make report variable that will fire your custom function (UDF) each time last record reached. Looks like following:
MyVar = iif(recno()=reccount(), MyUDF(), '')
And here is a clue - in UDF use 'GO TOP' command in case when you need to repeat report for second parse. (I HOOOPE this works, I'm not sure VFP report system allows that)
3. For titles (1990, 1991...) use array with dynamic indexing base on another report variable. Following will be in fields:
aMyYears[MyVar+1] aMyYears[MyVar+2] aMyYears[MyVar+3]
Following is definition of MyVar:
MyVar = 0 && initial value
MyVar = iif(recno()=reccount(), MyVar+3, MyVar)
'+3' - assuming you have 3 columns.

Hope this help.

I doubt however that you will be able to do the same for each page (in preview see page 1a, than 1b, than 1c, than 2a...), just because it is SOOOO hard to calculate number of records shown on page. If you're sure it is fixed, you may try to calculate it manyally by experimenting, however.

If you will have success with above, LET US KNOW, because this is VERY interesting topic. I made a lot of very complex reports in VFP but such kind. So I want to know this ;) [sig]<p>Vlad Grynchyshyn<br><a href=mailto:vgryn@softserve.lviv.ua>vgryn@softserve.lviv.ua</a><br>[/sig]
 
>>3. For titles (1990, 1991...) use array with dynamic indexing base on another report variable. Following will be in fields:
aMyYears[MyVar+1] aMyYears[MyVar+2] aMyYears[MyVar+3]
Following is definition of MyVar:
MyVar = 0 && initial value
MyVar = iif(recno()=reccount(), MyVar+3, MyVar)
'+3' - assuming you have 3 columns.<<

That's precisely how I've done it: the headers (years) are based on the column field names which are &quot;ACTL1990, Plan1990 etc. I use a UDF to return RIGHT(field(x + y),4) where y = 0 thru the total number of columns. The data are printed by retrieving the contents of the (x+y)th field using a UDF called fieldget(x+y) (the code I'm working on is Clipper, which had some great file manipulation commands. They were easily duplicated with UDFs, fortunately so except for some delimiters, I didn't have to change the original code substantially).

I have code to calculate the number of records on a page, as well as the number of columns, and for determining whether groups start on this or the next page etc. All of the hard work is done, so if I could just get the report designer to let me feed it the information I want it to use, the job's done. This is a tough one, and I'll keep you informed as this progresses. I won't get to it in earnest for a few days because of other priorities, but that's why I posted now: Load up on information then attack the problem.

And I will try your suggestion, but rather than reccount(), I'll use the last record printed on the current page, etc to start the next page, resetting it until eof is reached.

[sig][/sig]
 
Good luck! [sig]<p>Vlad Grynchyshyn<br><a href=mailto:vgryn@softserve.lviv.ua>vgryn@softserve.lviv.ua</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top