ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Filter for an currency field at standard filter amount Between two values based on range

Hello,

I’m trying to use a filter for an currency field at standard filter in listView page. I have a total amount and I want to look for docs that amount in range from value to another value ( total_amount >= value and total_amount <= value) I want to look for total_amount Between two value given in standard filter like in screen shot AmountRangeFrom and AmoutRangeTo

I do this filter in script

{“total_amount” : [">=",amountRangeFrom],“total_amount” : ["<=",amountRangeTo]}

but it give only the second one total_amount <= amountRangeTo like in screen shot

this the code of filter in script

Hi,
I may not completely comprehend the question however I was wondering if the Filter by , and Save Filter (with name) features on the left had been tried to construct the searches or reports?

I want to do filter of docs with total_amount between two value AmountRangeFrom and AmountRangeTo like for exemple in screen shot total_amount between 400 and 480 (AmountRangeFrom <= total_amount <= AmountRangeTo) in custom script

I do the filter with AddFilter in graphic it work

Add Filter

result

but I want to do it with script I do like :

frappe.set_route(“List”, “doctype”, {“total_amount” : [">=",amountRangeFrom],“total_amount” : ["<=",amountRangeTo]});

but it give only the second one total_amount <= amountRangeTo (total_amount <=480) like in screen shot


for exemple
I have two docs with total_amount 370 and 464
I want to look for docs with total_amount>=400 and total_amount <=480 it should give only doc with total_amount 464 but I have a result the two docs because only filter “total_amount” : ["<=",amountRangeTo] ( total_amount <= 480) work and not “total_amount” : [">=",amountRangeFrom] ( total_amount >= 400)
it accept only one for same field total_amount