Script Report python file return's advanced Use

Hi there,
We are normally using custom report python file to return columns and data.
But we want to send more data along with report to be used in html file.
I searched deep and saw below lines in query_report.py file

these lines are showing that we can return three other variables to be used.
But when i access message, chart or data_to_be_printed variables in html I found none of them are available there.
I am returning data from python file like this.
return columns, data, ["test"], [], ["data 1", "data 2"]
How to access these variables (message, chart or data_to_be_printed) in html file?
Please help.

It returns those values but it’s not available to use.

Just checked here

And I found that data_to_be_printed is available in html :slight_smile:
Tested and successful
That’s very nice, really needed this.
I hope this discussion or post will help others :slight_smile:
I Love ERPNext

BTW what’s your use case to use data_to_be_printed?

report template?

So to help others:
You can return from python file like below

return columns, data, [ ], [ ], [ "Data 1", "Data 2" ]

and the last parameter will be available in html under the variable of data_to_be_printed enjoy :slight_smile:

1 Like

Yes I want to print other information too in report html template. Before I was able to use only filters, columns and rows.
Now I can send other information through data_to_be_printed and use it while printing.

1 Like