Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 1 Monat
Letzter Beitrag:
vor 1 Jahr
Beteiligte Autoren:
Garry Allen, Mark Crichton, Allard, Piet van Zanten, Fabrice Harari

report problem - passing null to query

Startbeitrag von Garry Allen am 29.05.2017 12:22

I am getting rather frustrated with the report generator and I think I need a better approach to the problem.
I have a report based on a query and when I test the query it works but when I run the program and pass null for a parameter it always comes up with "No data to print".
I have tried passing the parameter as null in iInitReport Query, NOT passing the parameter, setting the parameter beforehand with QRY_ResByPeriod.pnCompanyID = NULL and all return the same result.
Is there some other method I should try?


Hi Garry,

there is no reason why a query would return a different result from inside a report, as long as you are settings it's parameters the same way...

So, show us your code and we'll help

Best regards

von Fabrice Harari - am 29.05.2017 12:56
Hi Garry,

It depends on how you pass the parameters and how you test the report.
In your case with an external query as report source you migth just as well use hExecuteQuery and iPrintReport in the calling code or do hExecuteQuery in the report init code.

Kind regards,

von Piet van Zanten - am 29.05.2017 13:03

Give us some code and we can have a look at it.



von Allard - am 29.05.2017 15:23
Hi Garry

I had this problem a little while ago.

Maybe the value Null is seen as a valid value of the field. Check if field has "NULL Authorised" checkbox ticked on the "Describing Items ... " in the analysis.

Hence the parameter NULL is maybe trying to filter out records with the field value = Null instead of ignoring the parameter.

von Mark Crichton - am 02.06.2017 05:42
Sorry to take so long to reply to this but I have been busy with another project.
I did manage to solve the problem but I did it with a bunch of case statements and passing the correct parameters for the query that the report is based on. Ultimately I think that Mark Crichton was on the right track and I will certainly watch for this in the future!
Thanks to all

von Garry Allen - am 19.06.2017 22:04
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.