Try ERPNext Buy Support Partners Foundation Foundation Members

Filters for custom report

I have written the following code in js file for adding filters but it’s giving me error as
Error: DocType Requester Name not found
The resource you are looking for is not available
how do i resolve this
I am not able to add filter.Please help

frappe.query_reports[“RS_Pending Demo Items to be returned from Customer”] = {
“filters”: [
{
‘label’: __(“Requester Name”),
‘fieldname’: ‘requester_name’,
‘fieldtype’: ‘Data’,
‘options’: ‘Requester Name’,
‘default’: ‘Select Requester Name’,
},
]
}

Fieldtype should be Link if Requester Name is a document.

I want to fetch requester name from doctype Demo Request. do i need to make any changes in the above code.
Below is the query i have fired
d.requester_name REGEXP %(demo_request)s

Yes, in options mention Demo Request.

Changed the options field to demo request but now i am getting key error : demo_request

I guess field name should be changed to drmo_request.

But now i am not able to fetch the table

query written for the same

SELECT DISTINCT
d.name AS “ID:Link/Demo Request:120”,
d.requester_name AS “Requester Name:Data:190”,
d.customer_name AS “Customer Name:Data:250”,
d.date_of_request AS “Date Of Request:Date:120”,
d.tentative_date_of_return AS “Tentative Date Of Return:Date:170”,
d.material_sent_from_location AS “Material Sent From Location:Data:190”,
d.delivery_note AS “Delivery Note:Data:100”,
d.material_status AS “Material Status:Data:120”,
d.product_supplied_condition AS “Product Supplied Condition:Data:150”,
d.courier_service AS “Courier Service:Data:120”,
d.shipped_date_from_rahi AS “Shipped Date From Rahi:Date:120”,
d.tracking_no AS “Tracking No:Data:120”
FROM
tabDemo Request as d
WHERE
d.docstatus like “1”
AND
d.material_status not like “Recieved From Customer”
AND
d.product_supplied_condition REGEXP ‘With Box|Without Box’
AND
d.requester_name REGEXP %(demo_request)s

Check your query conditions.
Comment all conditions and see if query is returning result. Thereafter see which condition is failing.

Not getting results due to this line
d.requester_name REGEXP %(demo_request)s
dont know what is the exact error.

Maybe try using RLIKE instead?

Used RLIKE. still facing the same issue. If i remove the below line
d.requester_name REGEXP %(demo_request)s
I get the output but the filter is not applied

To get past that, I would just modify to:
d.requester_name RLIKE 'demo_request'

Done the same thing as :
d.requester_name RLIKE ‘demo_request’
but still not able to get the results

@saurabh6790
I want to fetch the requester name but i am not able to do so. The filter is not working and its returning me the demo request files instead of requester name.Also i am not able to fetch the table. Also getting
KeyError: ‘requester_name’
Please help

Below is my js query:

frappe.query_reports[“RS_Pending Demo Items to be returned from Customer”] = {
“filters”: [
{
‘label’: __(“Requester Name”),
‘fieldname’: ‘requester_name’,
‘fieldtype’: ‘Link’,
‘options’: ‘Demo Request’,
‘default’: ‘Select Requester Name’,
},
]
}

Below is my query report:

SELECT DISTINCT
d.name AS “ID:Link/Demo Request:120”,
d.requester_name AS “Requester Name:Data:190”,
d.customer_name AS “Customer Name:Data:250”,
d.date_of_request AS “Date Of Request:Date:120”,
d.tentative_date_of_return AS “Tentative Date Of Return:Date:170”,
d.material_sent_from_location AS “Material Sent From Location:Data:190”,
d.delivery_note AS “Delivery Note:Data:100”,
d.material_status AS “Material Status:Data:120”,
d.product_supplied_condition AS “Product Supplied Condition:Data:150”,
d.courier_service AS “Courier Service:Data:120”,
d.shipped_date_from_rahi AS “Shipped Date From Rahi:Date:120”,
d.tracking_no AS “Tracking No:Data:120”
FROM
tabDemo Request as d
WHERE
d.requester_name REGEXP %(requester_name)s
AND
d.docstatus like “1”
AND
d.material_status not like “Recieved From Customer”
AND
d.product_supplied_condition REGEXP ‘With Box|Without Box’