1 (edited by iacobescubogdan 2020-11-11 15:38:02)

Topic: Please Help. Filter calculated field for a given date range

Hi, I want to filter data for a given date range.
Please help me to solve this problem.
I attached the project.
The end I would like to be a report in which I can see the sum of days off, for each employee, in a time interval.

Post's attachments

Attachment icon days off.zip 1.86 mb, 565 downloads since 2020-11-11 

Re: Please Help. Filter calculated field for a given date range

You may have to rethink the way you count presence and absence as your checkbox only check for people being present but the absent is in another column so your result is only going to be present.

Usually we use a boolean non null field with a default value for present or absent, if present, set a 1 otherwise it is a 0 and then counting people becomes easier. You can replace 1 and 0 by anything you want in your project.

3 (edited by iacobescubogdan 2020-11-12 08:00:18)

Re: Please Help. Filter calculated field for a given date range

Thanks for the reply. The problem is not the number of days and their sum. The problem is that I fail to report days off for an interval of days. The calculation is made for all days off from the first registration and I did not find the method by which I can see the amount of days off between day x and day y. I translated the project and simplified it a bit. In the attached example I would like to be able to see the amount of days off only from November, but the amount is also made with the days of October. (the 'report' button opens the form 'reportVASILE' and here I would like to be able to sort according to a date interval the total of free days). If I want to know how many days off "Eftimie Nicolae" had in November, the result includes the days off in October. How do I fix this? Please help me.

Post's attachments

Attachment icon days off en.zip 1.86 mb, 391 downloads since 2020-11-12 

Re: Please Help. Filter calculated field for a given date range

Hi Iacobescubogdan,
Welcome to MVD.
I had to change your original project a bit - it's not usually a good idea to try and combine data maintenance (add, edit, delete)  and data display / enquiry / filter all on the same form.  It results in a lot of extra coding to validate your data (blank and duplicate records are the main problem).  In your example, you also use comboboxes for both data input and for data filtering which can be confusing for users.
Please have a look at the attachment.  I've used 2 tablegrids on your 'grupavasile' form so you can see the employee summary and employee details at the same time (and it's easier to test (LOL!) that the filters and dates are working properly.  But it's easy enough to change the layout to suit your requirement - the basic processing is in place.
The employee summary (by selected date range) has to use an 'sqlquery' and there is also a small amount of code in the script (not strictly necessary - it just automates what you'd otherwise have to do manually.
Hope this helps,
Derek.

Post's attachments

Attachment icon days off 2.zip 1.89 mb, 544 downloads since 2020-11-13 

5 (edited by iacobescubogdan 2020-11-16 07:24:33)

Re: Please Help. Filter calculated field for a given date range

Hi Derek,

Thank you very much for the solution. It is indeed a much cleaner and more logical approach. I would not have been able to reach this result. I have a lot to learn. What you have done here helps me a lot and I appreciate your effort to help me and the less knowledgeable in general.

Iacobescu Bogdan.