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) {
console.log(r)
});
In the above code, it seems that it goes for the first filter of the same field
so this line wont run āattendance_dateā: [ā>=ā, ā2018-08-21ā ]
but in my situation, I need both greater than and less than operand to run
I have used between in the filter as followed:
frappe.db.get_value('Attendance', {
'employee': cur_frm.doc.employee,
'docstatus': 1,
'attendance_date': ["between", ["2018-08-21", "2018-09-21"]]
}, 'sum(actual_working_hours)', function(r) {
console.log(r)
});
but I have bellow error!
InternalError: (1241, u'Operand should contain 1 column(s)')
Is there Any other solution?
Thanks