Hi All;
I need to know the number of employees of certain specification. In other words, I need to know the number of filtered employees (the filter will be based on certain conditions). Do I need to use frappe.db.count or fappe.get_all?
I know that frappe.db.count(‘Employee’) will return the number of employee documents, but I do not know how to use it with filter.
Also, I know that I can use frappe.get_all with filter, but I do not know how to know the count of the returned values.
you can use the frappe.db.count same as frappe.get_all just pass the doctype and filters
e.g. frappe.db.count("Employee", filters={'company': 'Wind Power LLC'})
Thanks a lot.
This function, I can use it in python. Is there equivalent for it that I can use it in .js files?
Actually, when I am using such functions in python, and it was related to button, the problem that I need to display the resulted data on the form and the resulted data is not only one parameters, it is a lot of parameters (because I need to count too many cases and return the results of each case). So how I can return a multiple parameters to the java script if I used the frappe.call function and the callback? I am afraid the returned r can contains only 1 parameter, so in this case I have to use frappe.call function for each parameter. Appreciate the advise.
Regards
Bilal
Using whitelisted method and using frappe.call, how I can return 3 or 4 parameters that were calculated in the whitelisted method to the frappe.call at the .js that used to call the whitelisted method?
OK I resolved this problem. I can return the parameters as arrays (separating them by ,) and I can call them again using r.message[0] and r.message[1], … etc.
But the problem now in the filter: Is it possible to use OR operators? Because I need to filter based on multiple ORing cases. How?
As I know that filtering based on AND is possible.
Thanks a lot @Sangram for kindly help.
But now I am facing another condition that required to use OR operator:
I need to find the count for employee which their status is active or relieving_date is > some_date, how I can achieve this using filers and using frappe.db.count?