How to filter data in link field on script report filter field?

How to filter data in link field on script report filter field ?

https://frappe.io/docs/user/en/guides/app-development/overriding-link-query-by-custom-script

1 Like

is it possible to do the same thing in script report

did you find any solution?

Create your filters in the client code, not in the filter table.
Add the script below:

frappe.query_reports['report_name_here'] = {
    "filters": [
        {
            fieldname: "fieldname_here",
            label: "label_here",
            fieldtype: "Link",
            options: "doctype_of_link_here",
            filters: {
                "fieldname_in_link_doctype_here": ["operator_here", "valuefield_here"]
            },
        },
    ]
}

Make sure your reload page report before review

1 Like

Filter Based on another field

this.ro = this.page.add_field({
	label: __("RO"),
	fieldname: "ro",
	fieldtype: "Link",
	options: "RO",
	get_query: () => {
		return {
			filters: {
				site: this.page.fields_dict['site'].value
			}
		}
	}
});