I want to get my filter value from .js file into script file (.py) file in my query but i couldn’t get it… anyone could help me please
@frappe.whitelist()
def get_data(filters):
campaign_Name = filters.get(‘campaign_name’)
contest = frappe.db.sql(“”“SELECT contest_type FROM tabProperty Sales Campaign
WHERE campaign_name = %s”“”,campaign_name,as_dict=True)
frappe.msgprint(contest)
its my python function, at start i just want to get my filter value in that query
To set filters in js:
frappe.query_reports["Some Report Name"] = {
"filters": [
{
"fieldname":"supplier",
"label": __("Supplier"),
"fieldtype": "Link",
"options": "Supplier"
}
]
}
To use it in python:
class SomeReportName(object):
def __init__(self, filters=None):
self.filters = frappe._dict(filters or {})
Then, you can use them as : self.filters[“supplier”]
can you elaborate this…plz
how to implement in server side?
Have a look at [Tutorial] Script Report / Chart where I use filters extensively.