SQL Query Report

已查看 496 次
跳至第一个未读帖子

Akshay Mehta

未读,
2014年8月15日 04:22:032014/8/15
收件人 erpnext-u...@googlegroups.com
Hi,

Is there a way we can add and work with Parameters (?) in the SQL Query Report? If yes can anybody quote an example.

regards
Akshay Mehta

Rushabh Mehta

未读,
2014年8月15日 12:40:172014/8/15
收件人 erpnext-u...@googlegroups.com
On 15-Aug-2014, at 1:52 pm, Akshay Mehta <mehta....@gmail.com> wrote:

Hi,

Is there a way we can add and work with Parameters (?) in the SQL Query Report? If yes can anybody quote an example.

Check how you can set filters:



regards
Akshay Mehta

--
You received this message because you are subscribed to the Google Groups "ERPNext User's Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-user-fo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-user-forum/CAMgq%3DkeQPCjUMysn8EgtTNtC%3DC_jLpZUPpjPtHt7j3UwDLfGDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Akshay Mehta

未读,
2014年8月16日 03:20:412014/8/16
收件人 erpnext-u...@googlegroups.com

Akshay Mehta

未读,
2014年9月1日 04:01:322014/9/1
收件人 erpnext-u...@googlegroups.com
Hi,

I was successful in using the following TYPE of Custom report, but today it is giving an error :

Query Report :

select * from `tabItem` where name like %(name)s

Javascript:

frappe.query_reports['Test Query Parameter'] = {

    "filters": [

       {

       "fieldname":"name",

       "label":__("Item Name"),

       "fieldtype": "Data",

       }

    ]

}


Error :

Traceback (innermost last):

  File "/home/erpnext/frappe-bench/apps/frappe/frappe/app.py", line 49, in application

    response = frappe.handler.handle()

  File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 66, in handle

    execute_cmd(cmd)

  File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 89, in execute_cmd

    ret = frappe.call(method, **frappe.form_dict)

  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 529, in call

    return fn(*args, **newargs)

  File "/home/erpnext/frappe-bench/apps/frappe/frappe/widgets/query_report.py", line 81, in run

    result = [list(t) for t in frappe.db.sql(report.query, filters)]

  File "/home/erpnext/frappe-bench/apps/frappe/frappe/database.py", line 108, in sql

    self._cursor.execute(query, values)

  File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 185, in execute

    for key, item in args.iteritems())

 KeyError: 'name'


Any Idea?


regards

Akshay

Anand Doshi

未读,
2014年9月1日 06:25:212014/9/1
收件人 ERPNext User's Forum
also set "reqd": 1 for that filter and try.

-Anand.


Akshay Mehta

未读,
2014年9月1日 06:41:512014/9/1
收件人 erpnext-u...@googlegroups.com
does not work ... same error

akshay


Anand Doshi

未读,
2014年9月1日 06:49:392014/9/1
收件人 ERPNext User's Forum
Check if you are passing some value in "Item Code".

Also, confirm if the report's name is "Test Query Report", since you are using frappe.query_reports['Test Query Parameter']


Akshay Mehta

未读,
2014年9月2日 03:49:022014/9/2
收件人 erpnext-u...@googlegroups.com
Yes I think I was not putting any value in the field ....

Is it possible to set "default":"%%"? I tried this but did not work.

Akshay



Anand Doshi

未读,
2014年9月2日 04:49:332014/9/2
收件人 ERPNext User's Forum
Hi Akshay,

Should work. After saving the report, go to Help > Clear Cache and try after that

-Anand.


回复全部
回复作者
转发
0 个新帖子