VFP Report writer preview.

I am trying to print data from a memo field. I use MEMLINES() and MLINE() to put the data into an array.

The report has 60 fields and the EXPRession refers to the corresponding array element.

After 60 lines  are processed, the page is printed and  the array is cleared.

I recently had to work with a file created by another user. If I print from the preview screen it works fine. If I print directly to the printer, all I get is a blank page. No fileds, no labels: just a blank page.

I don't know for a fact that the memo was created within vfp with an EDITbox. It may have been done in a word processor and imported.  There may be some odd characters that are causing this. I can view the file for strange characters, but I don't know what to look for.

I packed the file by COPYing to TempFile, ZAPing and APPENDing FROM TempFile. No help, but the size reduced from 211,136 to 13,696 bytes.

I'm sorry I don't have more info, but any insight will be helpful.

Thanks,
Michael
MichaelKatzAsked:
Who is Participating?
 
pcelbaConnect With a Mentor Commented:
"If I print from the preview screen it works fine. If I print directly to the printer, all I get is a blank page."

Interesting behavior... typical for error in report definition but the preview should also be blank... It is almost impossible to help without your files.

The size reduction is obvious after file packing.

To remove "suspicious" characters from the memo you may use following code (but create a backup copy first!):


LOCAL cStr, i

FOR i = 1 TO 31
  cStr = cStr + IIF(i <> 13 AND i <> 10, CHR(i), '')
NEXT

REPLACE ALL YourMemo WITH CHRTRAN(YourMemo, cStr, '')

Open in new window

0
 
pcelbaCommented:
The FOR loop should also contain zero value:

FOR i = 0 TO 31
0
 
Olaf DoschkeSoftware DeveloperCommented:
What's in the report data environment and are you sure you select the alias you want to print from?

Bye, Olaf.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
MichaelKatzAuthor Commented:
Hi Olaf,

There is nothing in the data environment. It uses a private data session.
If I add a memo to the table it works fine.

Another interesting thing I just discovered.
The memo had 60 lines . If I reduce to 59 it works.

I don't think this makes a difference, but I first copy the designed report to a TempFile in case it needs hacking for formatting purposes. The troublesome memoes do not require any changes to the file.

I also used a "Wait Window" immediately before the "REPORT FORM. . ." command to display the value of various array elements and they were correct. So, the values were there, but something apparently simply ejects the page.

I realize this is bit of a puzzle, but I have no idea why it happens.
I tried pcelba's reccommendation and it did not help. Strange though, each time i run it, the file gets bigger.

Michael


0
 
Olaf DoschkeConnect With a Mentor Software DeveloperCommented:
Is there code in the detail band not only reading from the memo and creating the array but also writing back to the memo? Otherwise I wouldn't know why the data table should grow in size when you report from it.

If you actually at the command line do have the table selected and at runtime not, the case is clear, you only get a blank page because a record source is missing.

Even if all report fields are set to print an array element, a report always is controlled by the current active alias and the rpoert engine loops through all it's records printing a detail band for each record.

If no table is open and you have the array setup before printing, the report therefore still rpints nothing. What you need is a table with one record selected before issuing the REPORT FORM.

Bye, Olaf.

0
 
MichaelKatzAuthor Commented:
The table doesn't grow when reporting. I was referring to pcelba's code to clean it up. See above.  Each time I ran it, the file increased by about 12,000 bytes.

The detail band has 60 fields with the following expression:  Letterlines(1,2,3 etc.).

I get identical results from the runtime and development.

The report form command includes "NEXT 1" because the memo is a form letter that acts on 1 record at a time.

A table is open, and pointing to an appropriate record.  I get a blank page; no labels, no lines or anything.

As I mentioned above, I used a "Wait Window" immediately before the "REPORT FORM. . ." command to display the value of various array elements and they were correct. So, the values were there, but something apparently simply ejected the page.

Michael




0
 
pcelbaCommented:
It should be much easier to make a copy of the report and sample data, add the TXT extension and post it here.
0
 
jrbbldrConnect With a Mentor Commented:
"There may be some odd characters that are causing this. I can view the file for strange characters, but I don't know what to look for."

Since each individual line should only have alphanumeric characters + space & punctuation characters (I am assuming here), then you could pre-process each individual line to remove any possible un-wanted characters.

One way would be to do a character-by-character check to see if its ASCII value fell between your allowed parameters.
lcOrigLine = <the input line>
nLen = LEN(lcOrigLine)
FOR CharCntr = 1 TO nLen
   cTestChar = SUBSTR(lcOrigLine,CharCntr,1)
   * --- Now Test ASCII Value of This Char ---
   IF !BETWEEN(ASC(cTestChar),32,126)
      * --- Remove Char If BAD ---
       lcOrigLine = STUFF(lcOrigLine,CharCntr,1,'')
      * --- Reset CharCntr so as to Test Next Char In Same Position ---
      CharCntr = CharCntr - 1
   ENDIF
ENDFOR

Another way might be something like:
lcOrigLine = <the input line>
* --- Get Char String Of BAD Characters In Line ---
lcX = CHRTRAN(lcOrigLine, "0123456789abcdefghijklmnopqrstuvwxyzABDDEFGHIJKLMNOPQRSTUVWXYZ .,'", "")
* --- Remove ALL Bad Characters from Line ---
lcNewLine = CHRTRAN(lcOrigLine, lcX, "")   && remove unwanted chars

CAVEAT - I have offered possible approaches to the code above, and have not actually run any of that code, so there may be typos, etc.

"No fileds, no labels: just a blank page."
Generally when you get a blank page, it is due to some reference in the Report Form not being found.

In the VFP Development Preview or Print mode, the missing reference is usually 'popped up' so that you can change/modify/correct the parameter.

In the Runtime Preview or Print mode it usually shows up as blank.

"If I print from the preview screen it works fine"
But I can't tell from that if you are in the Development environment when you run that test or not.

If not, then I'd try running the code in the Development mode and putting a SET STEP ON just prior to the REPORT FORM command.   Then I would go into the Command Window and either do a MODIFY REPORT followed by a PREVIEW or just manually run the REPORT FORM command from the Command Window.

Good Luck
0
 
Olaf DoschkeSoftware DeveloperCommented:
It's normal that changing the memo increases it's size. The purpose of the code is to remove unwanted characters in the area of chr(0) to chr(31). But writing to memo always appends to the fpt file and invalidates the earlier pointer to a fpt file section. Only if you pack you see the shrinking of it, if there are such characters at all.

A blank report with no popup searching for a source, like jrbbldr describes simply misses records in the current workarea, then nothing is printed, not even labels, headers etc.

Bye, Olaf.
0
 
MichaelKatzAuthor Commented:
Thank you all.
This is what happened.

The memo had some function triggers that were surrounded by double angle brackets,
chr(171) and chr(187). These were picked from a list box.

Someone replaced them with 2 << and 2 >> , (the less than and greater than signs). The function calls were bypassed resulting in the wrong work area.

THANJ YOU ALL!

Michael
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.