ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Get-all query filter with child table fields

Is it possible to use child table fields in frappe.get_all() function?
Like I want to use them in filter part of it. If it is possible what is the syntax and if not then what could be best way to have such a query where we want to get a doctype record filtered on a child field?

1 Like

Do you find any solution ?

frappe.get_all("Sales Invoice Item",fields=["*"],filters={"parent":"xxx"})

You can apply child table field filters as:

records = frappe.get_all("Parent DocType",
    filters=[
        ...
        ["Child DocType", "field", "comparator", "value"],
        ...
    ]
)

You can still pass in filters for fields in the parent doctype as well this way.

3 Likes