ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Query Report with Empty Filter


#1

I am trying to create a report which by default has no value, and will only affect the report if it has some Value.

Traceback (most recent call last):
  File "/home/mohd/frappe-bench/apps/frappe/frappe/app.py", line 56, in application
    response = frappe.handler.handle()
  File "/home/mohd/frappe-bench/apps/frappe/frappe/handler.py", line 21, in handle
    data = execute_cmd(cmd)
  File "/home/mohd/frappe-bench/apps/frappe/frappe/handler.py", line 52, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/mohd/frappe-bench/apps/frappe/frappe/__init__.py", line 913, in call
    return fn(*args, **newargs)
  File "/home/mohd/frappe-bench/apps/frappe/frappe/desk/query_report.py", line 89, in run
    result = [list(t) for t in frappe.db.sql(report.query, filters)]
  File "/home/mohd/frappe-bench/apps/frappe/frappe/database.py", line 142, in sql
    self._cursor.execute(query, values)
  File "/home/mohd/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 238, in execute
    query = query % args
KeyError: 'user'

SQL Code:

AND (%(user)s IS NULL OR u.email = %(user)s)

JS Code:
> {

              "fieldname":"user",
              "label": __("User"),
              "fieldtype": "Link",
              "options": "User"
          },

Can anybody help me out with showing the entire data if no filter is selected?

Thanks!


#2

Is this still alive?


#3

Even I want to know the same. i.e. when no filter is selected all records are fetched