Accueil → WINDEV 2024 → No data to print after printpreview
No data to print after printpreview
Débuté par Frans, 20 jan. 2014 22:03 - 8 réponses
Posté le 20 janvier 2014 - 22:03
Hello to you all,

Suddenly in one of my reports the following happens:
I can click on 'print preview'.
It shows the report with its header, footer lines etc..
I click on the printer and it says 'printing' and immediatly after that the message appears:
'No data to print.'
Nothing comes out of the printer.

Anybody any idea?
Thanks in advance.
Posté le 21 janvier 2014 - 01:17
What is your data source ?
Posté le 21 janvier 2014 - 02:54
Hello Frans

I had a similar problem a few years ago. The problem was that during the running of the report the first time to the preview, part of my processing inside the report changed some of the data. It seems that the report runs twice, once to produce the preview and then again to print it and the printout then had no data to print because changes during the preview run affected the data collection for the print run.

Posté le 21 janvier 2014 - 09:57
Hello Derek and All,

Thanks for your answers.
Derek, there has been no change in de database and it runs locally.
All, I still don't now how that is possible. Wat was your solution?
Any hints would be welcome.
Thanks in advance.
Posté le 21 janvier 2014 - 10:39
Like Al I suffered this exact 'feature' some time back (v15 I think) and to be honest never really got to the bottom of it.
In my case I was using a query as the data source and my conclusion in the end was that for some reason the report was losing the parameters I was sending following the preview - it worked if I ran it without preview.

The problem here is that you have many options in the way you prepare and submit your data source (direct, query, table, structure) so any suggestions would be speculative.

Went through the usual deleting of the .env, .cpl files and running repair to no effect and in the end my solution was to re-write the report.
Actually took less time to do this than I had already spent trying to get the original to work.
Posté le 21 janvier 2014 - 11:56
Hello Frans

If you accept the fact that the report runs twice, once for the preview and again for the printout, then anything that happens inside the preview run may have an effect on the data generated for the print run. The proof of this would be to run the report direct to the printer without running the preview and if that works then something in the preview data collection is causing the issue

One way to find out the cause could be to selectively comment out any code in the report fields.
If the report data is from a query, then maybe refresh the query parameters as the last thing that happens in the report

Posté le 21 janvier 2014 - 13:45
Hi Frans

another thing your should check is your memory use... I think I remember that with the preview system, your second run of the query is done before the first one is released, DOUBLING the memory use... So if you don't have enough memory to run the query twice, anything can happen

Best regards
Posté le 21 janvier 2014 - 16:03
Hi. Try creating your data source before the preview or printing. For instance, if the data source is a query, try executing it in the code before calling the preview.

Also, there's a checkbox in the report description for the HF context. As someone said before, it seems that the data source looses its content before sending the report to the printer.

One more I would try: Send the report directly to the printer in order to see if there's the data.

Posté le 27 septembre 2022 - 20:38

I had the same problem, and the solution was in the report code in "Before printing the <report> report again" section use the iInitReportQuery function to re-run the query.