I need to filter all attendance between 2 dates variables but filter works on filters individually not get dates between
var start=someDate
var end =someDate
frappe.call({
method:"frappe.client.get_list",
args :{
doctype:'Attendance',
filters:{'attendance_date':['Between',start,'and',end]
}},
"callback": function(response) {}
})
1 Like
I had same issue and solve it
follow this steps
Hello,
I have a hosted ERPNext system needs a customization, I want to get a total of the field from the database
so I have used get_value function but I have a problem when I using between operand in the filter for a date, this is my code:
frappe.db.get_value('Attendance', {
'employee': cur_frm.doc.employee,
'docstatus': 1,
'attendance_date': ["<", '2018-09-21' ],
'attendance_date': [">=", '2018-08-21' ]
}, 'sum(actual_working_hours)', function(r) {
conso…
1 Like
I appreciate your response and thank you >>
I found its easier to use list in filter:
filters:[['attendance_date','>=',from_date] , ['attendance_date','<=',to_date]
1 Like
where do you put this string?
inside frappe.call() filters:
frappe.call({
method:"frappe.client.get_list",
args :{
doctype:'Attendance',
filters:[['attendance_date','>=',from_date] ,
['attendance_date','<=',to_date]
]},
"callback": function(response) {
console.log(response.message)
}
})
Liam
August 21, 2021, 7:19am
6
You can use ‘between’ for a date range.
frappe.call({
method: "frappe.client.get_list",
args: {
doctype: "Daily Power Usage",
filters: [
['unit_name', "=", unit_name],
['room_name', "=", room_name],
['power_usage_date', "between", [power_usage_date_from, power_usage_date_to]],
],
fields: ['name', 'unit_name', 'room_name', 'power_usage_date', 'power_usage_kwh'],
order_by: 'power_usage_date'
},
callback: function (r) {
console.log(r);
},
});
2 Likes
Also this can be accepted answer, Thanks for your effort
1 Like