[Tutorial] Script Report / Chart

this post is actual documentation of script report

2 Likes

Thanks for this @EugeneP. Just found it. It lools cool.

I am going to start working through this. My aim ?

  1. The existing P&L report handles account 5118 Expenses included in valutaion incorrectly
    ( in my view anyway ).
  2. The pie charts on some of the existing reports shows “group” accounts, which is
    not correct in my view. You cant have a pie-chart with “parent” (group) and “child”
    info in one chart.

So I am hoping to address this with my own report perhaps.

2 Likes

@EugeneP Thanks for taking time into this and sharing with the community. Really appreciate the effort. :heart:

1 Like

Thanks a lot for your sharing effort to explain these report details to the community. It’s really awesome to have contributors like you. Profile - EugeneP - ERPNext Forum

1 Like

Thank you sir, it is pretty awesome what u have given to the community

1 Like

Can you explain How to achieve Selectable rows in script report. e.g

image
Is there any way to remove the truncated from the names of the chart-legend? Lots of wasted space.

Eugene, your document is spectacular and greatly appreciated.

This is a big long-term maintenance problem.

Have you found a way to include Script Reports into backups, for example?

A symlink into the private files directory would work, I think.

1 Like

You can store report files in your custom apps folder. Play with the “Is Standart” and “Module” settings. Then the files will be stored in your custom app’s folder.

1 Like

Yeah!

I see that that works. Thank you.

@EugeneP how can we modified the table row height and width?

good idea

for my issue it’s work

thankyou

1 Like

How to remove or hide series no in script report…

On click of down arrow from column, you can able to remove. Or if you want permanently remove just comment the code in python file.

image
Thanks for replay. But it is default column. Not showing any arrow in that columns

@EugeneP , if I need to print some dynamic value in print template, how do you do that? Server call/Get value from DB call doesn’t work inside report html print format. I cannot pass this as either from the execute function. The only allowed ones are column, data, message, chart and report summary. Is there a way to add value to report context object that can be accessed inside html?

Hi @EugeneP,

Thanks for an excellent tutorial on Reports & Charts. Very informative, with clear examples !

1 Like

Hey, @zulfi007 ,
" The function get_datatable_options(options) generates a checkbox column. Upon clicking the ‘Get Selected’ button, it fetches data from the selected row in the report."

frappe.query_reports[‘Report Name’] = {
     onload: function(report) {
        frappe.query_report.page.add_inner_button(__(“Get Selected”), function() {
        var selectedRows = [];
         $(‘.dt-scrollable’).find(“:input[type=checkbox]“).each((idx, row) => {
              if (row.checked) {
                  console.log(“*** selected row id : ” + idx);
                  selectedRows.push(frappe.query_report.data[idx]);
              }
          });
            console.log("Selected row: " selectedRows)
      })
        get_datatable_options(options) {
                return Object.assign(options, {
                    checkboxColumn: true
                });
            }
     }
}
4 Likes

Hi, I want create custom chart in dashboard , to create graph of that month so

How can i do two chart or more in one script report