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!

Modifying Visual Foxpro Report 1

Status
Not open for further replies.

ostrowlaw

Technical User
Dec 4, 2009
18
0
0
US
Hi,

I have a VFP Report that I use to generate bills to my clients, but one of my clients needs a tweak to the report. So, I opened up the MODIFY REPORT command with the name of the report, made the change (it was a slight change, just taking out an invoice number) and then under File, saved as another report name. I then called the program using the new report name, but the report still prints out with the invoice number even though the report form I saved doesn't have the invoice number.

I am not a computer programmer, just an old user running my business on VFP (I started out with dBase II on CPM around 1985 and have been through dBase III, Foxpro 2.0, then went straight to VFP 9.0) so a non-jargon response would be most appreciated.

Thanks for your help.
Alan [dazed]
 
A Software would either have a report embedded in the EXE and so modifying a report doesn't change anything. On the other hand it is possible to have a report extern and use that. When you have that you can of course modify it, but rather would need to keep the unmodified version with a name suffix like "backup" and store the new report version under the old name so the application uses it.

Besides, I wonder which report design would contain a concrete invoice number, that is data that should not be a label or anything like that in the report design. If you'd need to modify a report every time you had a new invoice number, that would make it quite useless.

So actually repeat what you did, just a little different. When you open the original report that's still used, save that with a new name "yourreport_backup" for example.

Then close that , open it again from the original name, make your modification and save it under the name as is, just as change of the report, you have the backup in new files (notice in Windows explorer reports are always a pair of files frx and frt extension)

Bye, Olaf.

Olaf Doschke Software Engineering
 
Just to add to Olaf's good advice, it seems likely that the original report is "embedded" in your EXE file, while the new report exists as a free-standing file (actually, two files, an FRX and an FRT). The embedded file takes priority, which is why you are still seeing the old report.

To solve the problem, you need to rebuild the EXE. To do that, you will need all the source files that make up the application: forms, reports, PRGs (program files), and so on, including the new report's two files. (But not necessarily the data files.) You would need to put all the files into a project, and then "build" the project. That will result in a new EXE file, that you will then give to the client. (Be sure to keep the old EXE in case something goes wrong.)

You asked for a non-jargon explanation. I don't know how familiar you are with the process of building an EXE. If you need a detailed step-by-step guide, just ask.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Well, to tell you the truth, I don't use "stand alone" exe files, I still use VFP the old fashioned way as I've always done. Its a small office and the programs are for our internal use only. So each computer has a version of VFP on it, and the programs are like we always have done - DO program.prg, etc. Its worked for us for 40 years. Can't teach an old dog new tricks.

Remember please that when I first started with dbase II on CPM there were no programs available, we needed to learn how to get the program to do what we wanted. There were no programmers writing specialty programs for each office and profession. I learned to program myself just to do what I needed to do. Over the years, I've just changed the programs to do what we need. Hence, I have one report for billing, which is used for all of our clients, but one of our clients asked that the computer generated invoice number be deleted (just to be a pain!!). So, I'm trying to just have a separate report form for that client which is in all respects identical to the form we use for everyone else, just with the invoice number removed. Should be easy but, as you show above, not so easy.

Isn't there a simple way to do this?

Thanks
Alan [bigsmile]
 
So when you want to run a report, you issue REPORT FORM followed by the name of the report file (the FRX). Is that right?

If so, then it looks like you are simply specifying the wrong report file, that is, you are picking up the old report rather than the new one. That's probably because the old and new reports have the same filename but are in different folders. If that's right, it is just a matter of finding the old report file, moving it to a backup location, and then moving the new file to the folder where the old file was previously stored.

Keep in mind that when we talk about a report file, there are really two file, an FTX and an FRT. Always keep them together. Whenever you move one of the them, move the other one along with it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
In fact, there is a better way to handle this situation. Rather than having two separate reports - one with and one without the invoice number - continue to use a single report. Include the invoice number as usual. But in the invoice number's properties, go to the Print When tab. In the box labelled "Print only when expression is true", enter a condition that will tell the report whether or not to print the invoice number.

For example, if it is client XYZ that wants the invoice number suppressed, the condition that you enter in the box might be something like [tt]Client.ID <> "XYZ"[/tt].

That way you will only need one report file, which will make things much simpler.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
one of our clients asked that the computer generated invoice number be deleted"
Is that really legal in your country? Here it isn't.
If an audit is done, there should be an unbroken sequence of invoice numbers, right?
 
I think he meant deleted from the report, that is, don't show it in the report.

Tamar
 
I understood that, Tamar, but that was what I meant also. If the number doesn't show on the invoice, how can one do an audit?
 
Several options, depending on auditor's method.

If report source is a dbf, keep invoice number in the dbf, just use the "Print only when expression is true" option when printing client's copy. Then show auditor dbf content.

If auditor must see a printed copy, reprint that client's invoice(s) showing the number. There are several ways you can do that. It seems unlikely the auditor would want to visit all your clients to make sure their copies have consecutive numbers.

Steve
 
Thanks, you guys are awesome! This particular client has perhaps 30 different entries on an cumlative invoice with the title portion of the report showing the sum total of all of the separate invoices. So, for whatever reason, they don't want each separate entry to have an invoice number. I don't question why, I just figure out how to accomplish this. The invoice numbers are randomly generated by my VFP program, they are not part of my DBF.

I will try to modify the field using Mike Lewis' response and see what happens. Yes, this is the most logical way to do this. When the program which calls the report runs, each client number is stored in a memory variable named "IDLER", so I just changed the report field entitled "Invoice No." to print when "IDLER # 70".

Tried to run off an invoice using client number 90 and it is still printing off the invoice number. [surprise] I guess either I got the syntax wrong or my memory variable isn't present when the report is printing (??)

Again, I'm not a programmer, just an old guy trying to get the job done. I'm not used to having the program (or the report) do my work, I'm used to having to write a lot of lines of program to accomplish something easy like this.

[pipe]
 
Got it, worked great!!! Thanks again for all your help and especially to Mike Lewis for the "heads up" regarding the "print when" in the report.
Now I want to go back and look at all my reports to see how to make them run more efficiently.

Greatly appreciate all the help I get here. [thumbsup]
 
First, if you set Print When to tell it to print when Idler is not 70, and "using client number 90 and it is still printing off the invoice number", then surely that's correct? You are telling it to print the invoice number for all clients except no. 70.

But, more importantly, it is no good comparing the invoice number to the contents of a memory variable. You will store a value in the memory variable before you run the report. It will remain unchanged throughout. So if you set Idler to the client number, then it will contain whatever client number was in the current record before you started printing. That's not what you want.

What you need to do in your Print When is to test the client number from your table (your DBF). So, if the table contains a field called Client_No, then the Print When would be [tt]Client_No <> 70[/tt].

You might want to go further and set things up so that you can choose whether or not to print the invoice number for every client. To do that, you would add a logical field to the table. Let's call it Suppress_Inv. It would normally be set .F. But for the exceptional client that doesn't want the invoice number, you would set it .T. Your Print When would then be [tt]NOT Suppress_Inv[/tt]. That way you wouldn't have to alter your report if and when other customers start asking for their invoice numbers not to appear.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I have the program that calls the report form do while idler < 100, store 1 to idler, then I run the report, then idler = idler+1.
report form bills for idler = clientnum

Some idea I think (??) in my old fashioned way.

Again, thanks for your help, it was great and now I have more ideas. . .[thanks2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top