Hi Community,
I'm working on a vacation request form in ConfiForms and need some assistance with a few key features I can't seem to get working properly. Here's what I'm trying to achieve:
My Requirements:
Employee Entry Fields: The form should allow employees to enter just the date-time interval (start and end) and assign a substitute. This information should be displayed in a Calendar View for easy visualization of their vacation.
Leave Days Calculation: Based on the interval, the system should automatically calculate the number of leave days and subtract it from the default annual entitlement of 30 days.
Remaining Leave Display: I want to show the remaining leave days after each vacation entry using valueView. For example, if an employee uses 5 days, the next time they view the form, it should display their remaining leave (25 days in this case).
Dynamic Remaining Leave for Future Entries: When an employee submits another leave request, the form should dynamically calculate their remaining leave and subtract the new request from that balance, not from the default 30 days again.
Issues I'm Facing:
Date-Time Interval Calculation: I'm currently using two separate dateTime fields (start and end dates) because I couldn't figure out how to use a single interval field to calculate the number of days. I need a solution where the number of vacation days is computed directly from the interval. This my calculation rule:
urlaubstage=([entry.Zeitraum2.timestamp]-[entry.Zeitraum1.timestamp])/86400000+1
=> Here I Caluculate with two DateTime field but i cant show that in an intervall in calenderView. With DateTime Intervall field it is possible but i cant calculate with it.
Filtering valueView for Remaining Leave by createdBy: I can’t seem to filter the valueView correctly based on the logged-in user (createdBy) to show their remaining leave. Every user should only see their own vacation days and remaining leave.
Updating the Remaining Leave Dynamically: After a user submits a vacation request, the system should store their remaining days (calculated after subtracting the current request). This value should be used as the baseline for future vacation requests, not the default 30 days.
What I've Tried So Far:
- I’ve attempted to use two
dateTime fields and calculate the difference in days, but this approach feels cumbersome and error-prone. - I’ve looked into
valueView filters but haven’t had success in filtering by createdBy and summing the total days off taken by the user. - I understand there may be a need to store the remaining leave days in a hidden field for subsequent form submissions, but I'm unsure how to implement that correctly.
Any Suggestions?
Has anyone successfully built something similar? How can I:
- Efficiently calculate leave days based on a date-time interval?
- Filter the vacation entries by user (
createdBy) and display their remaining leave dynamically? - Ensure that future vacation requests are deducted from their previously calculated remaining leave and not the default 30?
I'd appreciate any code snippets, configuration examples, or even alternative approaches.
Thanks in advance! 😊