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

Report Form: How to show a complete page as the last page 4

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB
Hi

I have a question about the creation of a report form:

[ul]
[li]A report form has been created (myreport.frx)[/li]
[li]In the TITLE band are label and fields which only appear on page 1 of the report - Thats ok and what I need[/li]
[li]The PAGE HEADER band also contains label and fields which appear on subsequent pages which are > 1 - That's also what I need[/li]
[li]In the DETAILS band is a couple of fields, one of which is memo field (set to stretch as appropriate) which appear on all pages - Thats ok too[/li]
[li]The PAGE FOOTER band also contains a couple of labels and fields which appear on every page as you would expect[/li]
[/ul]

Now, what I can't figure out is how to add text and fields from a full page that I want to show as a last page. So what I mean by this is:

My report prints out correctly, showing title band, page headers (if more than one page), the details from the memos fields in the details band and the page footer information.

I have a full page of certain fields and text which are from the Parent table that are fixed and I want these to be part of the complete report. I can run the reports I have created independently such as:

Code:
REPORT FORM myreport PREVIEW FOR (Condition etc)
REPORT FORM mylastpage PREVIEW FOR (Condition etc)

but ideally I would want these to be one entity instead of two.

Causing two REPORT FORM statements is ok if you just want to "Straight forward" print out documents and thats fine but I want to save the report in certain formats and I have found foxypreviewer which works an absolute treat and converts the reports into pdf's, rtf's with ease.

So with this in mind, how can I add that last page to my report?

I have tried adding additional DETAIL bands, using a GROUP FOOTER band but when you extend these, the report is extended, loses it format amongst other things. I also tried using the SUMMARY band and whilst this does show after the last line of data shown in the DETAIL band, it is usually halfway up the page and again, causing havoc with the layout and does not show the full page of my last page.

As always some guidance would be very much appreciated.

Thank you


Lee
 
Lee,

Have you tried adding NOPAGEEJECT to the first of the two REPORT FORM commands?

I know that will work in printed versions of the report, and also if you export to PDF, etc, using XFRX. I don't know if it will work with FoxyPreviewer, but it would be worth a try.

Basically, NOPAGEEJECT tells VFP to treat this report, plus the next one, as the same print job.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hi Mike

Just tried your suggestion but it only creates a report with the last page.

Now this could be to do with foxpreviewer so I'll look a bit deeper.

If I were using XFRX what would be the command you would use just to give me an idea of the coding structure?

Something like this maybe?

REPORT FORM myreport PREVIEW FOR (Condition etc) NOPAGEEJECT
REPORT FORM mylastpage PREVIEW FOR (Condition etc)

Thanks Mike


Lee
 
Lee,

REPORT FORM myreport PREVIEW FOR (Condition etc) NOPAGEEJECT
REPORT FORM mylastpage PREVIEW FOR (Condition etc)

That's exactly what you want if you were printing the reports. Before going any further, I suggest you check to see if that gives you what you want. If it does, we can look for ways of doing the PDFs, etc.

I've just been looking at my XFRX code. It's not quite as I remember. To simplify, the code looks something like this:

Code:
* Instantiate XFRX
loXFRX = XFRX("XFRX#LISTENER")

* Various settings
WITH loXFRX
  .TargetType = "PDF"     && says to print to PDF
  .DoNotOpenViewer = .T.  && says not to display the PDF on completion	
  .QuietMode = .T.        && don't show "Rendering ... " wait window
ENDWITH 

* Output main report 
REPORT FORM cust_first OBJECT loXFRX 

* Ensure summary gets appended to main report
loXFRX.AppendToFile = .T.

* Output summary
REPORT FORM cust_summary OBJECT loXFRX

This is just to give you the general idea of the code. It's not meant to be a working example.

In general, with XFRX, the coding is quite simple. But you've got to factor in the cost of the product, and the extra effort involved with deployment, etc.

Another option would be to "print" to a PDF printer driver. That's the simplest solution, but it relies on the user having an appropriate driver installed.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks Mike

I'll need to try the NOPAGEEJECT command when I have access to a printer so I'll post back as soon as.

Lee
 
What I have done when I need to completely different Report Forms consolidated into one single report is somewhat 'kludgy', but it has worked for me well.

An example of this has been to create a Cover Page followed by one or more Detail/Report pages all written as one single VFP Report - where the Cover page is totally different than the following pages.

I create a Report Form myreport and save it somewhere.
One note here is that I hack the Report Form data table and do a REPLACE ALL SupExpr WITH <something> - this is the PRINT WHEN....
I put into these fields some differentiating Expression that will control when to print these Report Form objects.

Then I go on to create a different Report Form mylastpage and save it somewhere else.
And again I hack the Report Form data table and do a REPLACE ALL SupExpr WITH <something else> - this is the PRINT WHEN....
I put into these fields some different differentiating Expression that will control when to print these Report Form objects.

Now I create a new Blank Report Form.
I open the first Report Form, do a COPY ALL, and then PASTE it into the new Blank Report Form.
I now repeat the process with the 2nd Report Form.

So I now have one VFP Report Form with over-laying Report Form Objects but they all have their own differentiating PRINT WHEN... expressions.

That new report is saved to become my final Report Form.

Now back to the programming side of things.

In my Report Data, I have added one (or more) fields to the data records which will control the PRINT WHEN... expressions in the Report Form.

Despite the fact that this is a somewhat convoluted process, it has worked well to meet my client needs.

Good Luck,
JRB-Bldr
 
I'll gladly admit my ignorance regarding the use of NOPAGEEJECT.

I have never used NOPAGEEJECT so I don't know if it would end up creating a single Report (perhaps written to a single PDF file, etc.) while using 2 different VFP Report Forms.

Good Luck,
JRB-Bldr
 
If you have VFP 9 Sp2 then you can use VFP's _ReportListener to chain reports together when previewing on the Screen as well as printing. This will allow them all to be displayed and printed as if they are one report.

loListener = newobject('_ReportListener', home() + 'ffc\_ReportListener.vcx')
loListener.ListenerType = 1 && Renders All Pages To Preview
loListener.AddReport('ReportName1.frx', 'nopageeject')
loListener.AddReport('ReportName2.frx', 'nopageeject')
loListener.AddReport('ReportName3.frx', 'nopageeject')
loListener.AddReport('ReportName4.frx', 'nopageeject')
loListener.AddReport('ReportLastPage.frx')
loListener.RunReports()

Think of this section 'nopageeject' as the same part you would typically write after Report Form..... with this you can do almost anything.

If you don't have SP2 you can still achieve the desired results, but it becomes more complex.

 
JRB,

NOPAGEEJECT only arrived in VFP 8.0. If you started out with an earlier version (as many of us here did), that might explain why it's new to you.

Networkthis,

You say "If you don't have SP2 you can still achieve the desired results, but it becomes more complex." But with VFP 9.0 (with or without any SP2), you can use NOPAGEEJECT with previews as well, using a simple REPORT FORM command. (But not in 8.0, apparently.)

Mike





__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike,

To clear it up for others, NOPAGEEJECT has been around for a while and works great when you need to print multiple reports as 1.

You can use a NOPAGEEJECT with previews, but from my experience, it only chains reports together when actually printing.

Doing this:

Report Form ReportName1 Preview Nopageeject
Report Form ReportName2 Preview

Is the same as this:

Report Form ReportName1 Preview
Report Form ReportName2 Preview

This will Display both Reports, but each will be displayed in seperate containers. The code I showed above, will allow for all of the reports to be seen in the same Preview Container, which is rendered as FRXPreviewForm through the reportbuilder. The 'nopageject' in the code above is necessary to get the "chained" report look and for printing from Preview. You can also add NORESET, [or other REPORT Form commands in addition] like this "nopageeject, noreset" for example if you wish to (Preview) a chained report, which we know is not really one report, but displays the reports all together as in one preview window and keeps the page numbering all together as if it is one report.

Maybe the code does work in VFP 9 witn no SP or SP1. I started off coding with SP2. We have SP1 on our test machines we use before deployment and the code unfortunately doesn't work on it, which meant a lot of extra coding on my last project.
 
Is there some reason you can't use the Summary band and put it on a new page?

Tamar
 

All: I did forget to post that I have VFP9 with service pack 2 (my apologies)

networkthis: Thank you for the post which makes a very interesting read. I wont have access to a computer or printer until tomorrow (just my trusty iPad at the moment) so I'll post back when I have had a chance to try this out.

Tamar: I did try to use the summary band as mentioned in my post but this either showed the information I wanted halfway down the page or sometimes near the end of the page, depending where the last data from the child record memo field was shown in the detail band. Unless you know a way of causing the summary band to show on a new page when everything else has processed?

I am going to give networkthis and JRB-Bldr suggestions a go and will reply back in due course.

My sincerest thanks again guys

Lee
 
Networkthis,

I have to disagree with you.

Try this (in VFP 9.0, with or without service packs):

Code:
SET REPORTBEHAVIOR 90
REPORT FORM Report1 PREVIEW NOWAIT NOPAGEEJECT 
REPORT FORM Report2 PREVIEW NOWAIT

You'll see that the reports are chained together in a single preview container, with the ability to page forward and backward, as if it was a single report.

However, that doesn't answer Lee's question, as he did not mention the requirement to preview the reports. His only remaining difficulty is that he wants to send a chained report to a PDF.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Lee,

I still think that the simplest solution would be to use NOPAGEEJECT with two separate reports, and to send the output to a PDF printer driver. I know that means you will have the constraint of ensuring that the end users have a suitable driver installed, but you should at least consider this approach.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hello Mike

I'm going to look into this a bit later on and since posting it looks as though the preferred output is going to be a word doc (or rtf).

The reason behind this is because we may need to edit the word document at a later time once it has been produced.

So the PDF option may be out the window for short term.

Will post soon


Lee
 
When I check to add a Summary band to a report, one of my options is "Summary prints as new page." Pre-VFP 9, it just reads "new page."

Tamar
 

Mike & Tamar

Thank you for your posts. I have been side tracked somewhat today so hope to check out all these suggestions tomorrow.

Regards


Lee
 

Tamar

When I check to add a Summary band to a report, one of my options is "Summary prints as new page." Pre-VFP 9, it just reads "new page."

Oh yes!!

I cannot believe the amount of blood, sweat and tears (well maybe sweat and tears) that have been shed trying to resolve this when it really was as simple as adding the summary band to the end of the report (which I admit I did try) and selecting the options "Report has summary band" and "Summary prints as new page" (which I didn't previously do!)

So this is what I have which is now working perfectly:

Code:
USE MYTABLE

* Preview the report first

REPORT FORM myreport NOCONSOLE PREVIEW FOR LINK=myvariable

* Start FoxPreviewer

DO LOCFILE("FoxyPreviewer.App")

* Create an RTF type document
		
REPORT FORM myreport OBJECT TYPE 12 TO FILE "\myfolder\mydocument.rtf" PREVIEW FOR LINK=myvariable

* Create a PDF type document

REPORT FORM myreport OBJECT TYPE 10 TO FILE "\myfolder\mydocument.pdf" PREVIEW FOR LINK=myvariable

* Now release FoxyPreviewer

DO FoxyPreviewer.APP WITH "Release"

Just a note on FoxyPreviewer (I do not have any association with it) but it is a very easy app to use and creates the desired results. It also offers multiple output formats and perhaps the most important thing is it's free (But you can make a donation to the author).

My sincerest thanks to all those who posted. Onwards and upwards I say!

Enjoy your weekend guys (I'm going to) [cheers]


Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top