Has anyone tried the above? I am able to create a Script Report by writing code in the “Query/Script” section and “Client Code” section of the Edit report UI. Please note I am not writing any code in python or JS files. All the code is written in the edit report UI.
Now, the filters are defined in the “Client Code” section using Javascript like below:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
posting_months = [“April 2024”, “May 2024”]
frappe.query_reports[“Cost Center wise Breakup”] = {
“filters”: [
{
fieldname: “Vertical”,
label: “Vertical”,
fieldtype: “Data”
},
{
fieldname: “Project”,
label: “Project”,
fieldtype: “Data”
},
{
fieldname: “Cost Center”,
label: “Cost Center”,
fieldtype: “MultiSelectList”,
get_data: function(txt) {
return ['Admin/Overhead ', 'Curriculum ', 'Events/Showcase ', 'Finance ', 'Fund Raising ', 'HR ', 'L&D ', 'Marketing ', 'Monitoring & Evaluation ', 'Operations ', 'Process Excellence ', 'Product ', 'Team Awards ', 'Technology ']
}
},
{
fieldname: “posting_month”,
label: “Posting Month”,
fieldtype: “MultiSelectList”,
options: posting_months
}
]
};
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
In the above code if I want to get the values for the multiselect using a SQL with joins, how would I do that? I haven’t seen any examples. Every example uses a single doc type to get the values. I tried frappe.db.get.sql, but it doesn’t seem to work. I understand this is primarily JS code and hence some of the frappe APIs may not work. What are the options to get the data? Can I read data in the report and get values from that using the client side script?
Thx