Reports
Reports
(OP)
I am an amateur programmer, though I did use VFP5 to develop a program to catalogue dog shows. I am now producing an application, after a gap of several years, to print monthly invoices for my bridge club members. I have been following earlier discussions on Tek-Tips and have installed Foxypreviewer. I can produce the report for an individual member but the problem I am having is changing the name from invoices.frx to SmithJ.
The code I used in the command window is to get it to work is
REPORT FORM invoices FOR ebu_number = ebNum;
OBJECT TYPE 10;
TO FILE "c:\users\userpc\documents\invoices\.CarterP.pdf")
When I tried this using a memory variable it failed.
Advice or help would be much appreciated.
The code I used in the command window is to get it to work is
REPORT FORM invoices FOR ebu_number = ebNum;
OBJECT TYPE 10;
TO FILE "c:\users\userpc\documents\invoices\.CarterP.pdf")
When I tried this using a memory variable it failed.
Advice or help would be much appreciated.
RE: Reports
welcome. It's always good to hear more people thn are activley posting profit from the forum.
I could only point out what you did wrong, when you post your failing code instead of what works.
If a concrete file name works, then it should also work when first put into a variable. Does it work, though? I assume the actual problem is that foxypreviewr jut generates a file with the name of the FRX, just with the extension changed to PDF.
I think it depends wheter you use the last verson belwo 3, the 2.99something version vs the 3.0 version. But I would also solve this by just renaming the output file after FoxyPreviewer generates it, that'll work anyway.
Chriss
RE: Reports
cFname = ALLTRIM(playersnames.filename) +ALLTRIM(".pdf")
cfname = "c:\users\userpc\documents\invoices\" + cFname
REPORT FORM invoices FOR ebu_number = ebNum;
OBJECT TYPE 10;
TO FILE cfname
This brings up an error FX_6VP0TZMO0
Error 10
Method unloadreport
Line 18
SET CONSOLE&llConsole
on closing this a message box Variable " is not found
RE: Reports
Code
cNewFile = ALLTRIM(playersnames.filename) + ".pdf"
cNewfile = "c:\users\userpc\documents\visual foxpro projects\" + cNewFile
RENAME "c:\users\userpc\documents\visual foxpro projects\invoices.pdf" TO cNewFile
This just comes up with file already exists message and nothing happens.
As there are usually 30-40 to change I really need a program to achieve the name change.
RE: Reports
The first thing to do is to examine the contents of the variable, cfname, to check that it contains what you expect. It is easy to go wrong when attempting to build a file and path name by concatenating the various elements in this way.
So, when you see the error message, hit the Suspend button. Then bring up the Debugger (by typing DEBUG in the command window). In the Debugger's Locals window, scroll down and look for the cfname variable. That will tell you exactly what it contains.
If the variable is not present, or you don't see an error message containing a Suspend button, then put SET STEP ON immediately before the REPORT FORM command. Then bring up the Debugger, as above. (And remove the SET STEP command when you have finished.)
(Welcome to the forum, by the way.)
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: Reports
CODE -->
For that to work the way intended you need
CODE -->
The brackets make a difference here in what VFP sees in that. And it's a bit annoying because all that would not arise if they would have decided against the ability to write literal file names without quotes in commands like COPY TO or CREATE TABLE or RENAME <file>. It's useless in case the file name has spaces anyway.
Chriss
RE: Reports
RE: Reports
DO WHILE NOT EOF()
nEbunum = Ebu_number
REPORT FORM invoices.frx FOR EBU_Number = nEbunum noconsole TO PRINTER
cOldFile ="c:\users\userpc\documents\invoices\invoices.pdf"
cNewFile = ALLTRIM(playersnames.filename)+ ".pdf"
cNewfile = "c:\users\userpc\documents\invoices\" + cNewFile
RENAME (cOldFile) TO (cNewFile)
SELECT playersnames
SKIP
ENDDO
Works perfectly when I run under the debugger to a breakpoint and F8 but when I try to run it as a non-stop program it tries to find the old file before Bullzip has created it an comes up with an error.
I tried using Foxypreviewer bt this adds unwanted line to the pdf. Any suggestions would be welcome.
RE: Reports
RE: Reports
CODE -->
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: Reports
The way to cover Bullzip means to be more intelligent about waiting for the invoices.pdf to exist and be able to rename it. First step is waiting for the file to exist, next step is trying to FOPEN it with write permission, as long as that's not working wait for Bullzip to finish.
If you use Bullzip you also have means to configure it via Windows printer driver settings to change the name of the output file to something else that could also work for you.
Chriss
RE: Reports
I would like to configure Bullzi to accept the name of the output instead but have no idea how to do this and find the documentation less than helpful.
RE: Reports
Therefore actively wait for what you want to see happening and finishing. I bet you could also get more complicated and hook on Windows print job queue and find out when that becomes empty again, but as you know a file will be generated it's best to wait for exactly that to happen, and for the file to be available to your renaming, which only can be done, when Bullzip has closed it.
Well, even if you could rename it earlier, it would make Bullzip fail to write to it, wouldn't it?
Chriss
RE: Reports
I would suggest something like:
CODE -->
Greg
RE: Reports
Did you really mean to expose your email address in this way? If not, you might want to hit the Edit button (at the bottom right of your post) to remove the images, then perhaps upload a version with the email addresses blurred or removed.
If you are not worried about this, just ignore it.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: Reports
RE: Reports
CODE -->
You can do this quite as the first commands in main.prg
Or think about adding https://github.com/atlopes/DPIAwareManager to your project.
But you should also be fine using the latest FoxyPreviewer, because in the later versions, at least since about 2.5 I think, FoyPreviwer has already been mde dpiaware, which version are you using? If your answer is I don't know I downloaded it way back, just a simple refresher on the thought that a problem with a software usually could have become known and fixed in a later version...
Regarding an extra line, you literally meant a line, as you first talked about that I thought it was a line of text, like a comment added by FoxyPreviewer. Well, a Line object doesn't creep into a report on itself alone. I can't see how Bullzip doesn't print it, but there has to be a line object in your report layout that you don't want to print, maybe right at the edge of a band, like the detail band. So, well, find it and remove it. It may help to higher the size of a band where it hides off. So maybe FoxyPreviewer has a bug not respecting objects off view by band height, but then I'd rather delete a line I don't want to print then hide it away off limits.
Regarding the image, you may also alter its properties (right click the image and pick properties) from "Clip contents" to "scale contents, fill the frame", for example. Depends what you want, but if the image looks clipped alreadyy in the report designer, then this time Bullzip disregards the clipping and prints the image as large as it needs to be anyway. I'd say while the result is what you need Bullzip then plays it wrong. Just assumptions, though, but you see you have options in how an image is printed and scaled or clipped.
Chriss
RE: Reports
RE: Reports
Greg
RE: Reports
But I'd also look into where that line comes from in the report designer or, if you don't find it there, USE your.frx as a table and look for a record with OBJTYPE=6.
Chriss
RE: Reports
RE: Reports
If a line is out of sight by being moved into the grey title area of a band it may be in "no mans land", but would still be printed, there also is no visible property, reports work totally different from forms, there only is a print when expression you can set to print it conditionally or not. Where it was it seemed like a line someone thought would go away by moving off the white band area, but since bands are repeated also things with negative coordinates appear above the normal band area.
So the FoxyPreviewer actually does it better, even though the outcome with Bullzip is better for you. Nevermind, if it works don't break it now by trying to get it converted with FoxyPreviewer, too. I bet the "scale contents, fill the frame" setting for the image would also solve the last problem. Anyway, you already got it done with Bullzip now.
Chriss