Need guidance with this script

Hi All ,

I am trying to filter the items with this code but it always takes the last condition and ignores the first condition , I want the filter to consider both the conditions.

"filters": {
"cmill": [">=",r.message.percnt_carbon_min],
"cmill": ["<=",r.message.percnt_carbon_max],
}

Please help

Thanks in advance

Tried with this but it is not working ,

"filters": {
"cmill": [">=",r.message.percnt_carbon_min && "<=",r.message.percnt_carbon_max]
}

please help

Thanks in advance

You cannot write same keys twice in a dictionary.

For this case, you need to write a function in the server side with proper mysql query and call the function from js.

For reference check

https://github.com/frappe/erpnext/blob/develop/erpnext/buying/doctype/quality_inspection/quality_inspection.js#L27

https://github.com/frappe/erpnext/blob/develop/erpnext/buying/doctype/quality_inspection/quality_inspection.py#L41

2 Likes

@nabinhait Thank you Sir , I will try