Hi Folks,
I am developing a power app for time in lieu request. The way it worked it user first make a request by providing start and end date time and other fields. Then flow run and request send to user's Manager for approval. After approval , a dedicated leave balance added to user record i.e. HH:MM. When user make a another request to take time in lieu, balance will be deducted from user leave balance. This is the working of entire app in short.
There is one requirement when user do after hours work i.e. between 11pm to before 6 am , time will be double. For example if user work from 15/07/2024 10:00 PM till 16/07/2024 01:10 AM, then total time he worked 5:20 (HH:MM) (10 PM TO 11 PM = 1 Hour, 11PM to 01:10 AM = 4:20). Thats all i have calculated in Power app On select event of Submit Button.
Now i have below requirements and need input:
STartDateTime:
End DateTime
1. what if user works on Weekend. Or start from 11 PM Friday till 9 am Saturday. What would be the best approach to figure out when to add double hours or not on Weekend.
2. Right now, its hard code in my app if user work after 11 pm and before 6 am, i am doubling the time. What if requirement change they want from 10 pm to 3 am. I need to change the app code again.
I am looking for some generic solution's where either i create a another list for this rule or something.
Where do you want to store this information? You can definitely handle the requirements you have inside of powerapps. You can create conditionals for all the conditions you specified, and set the 'hard coded' version you made to variables in a different place that way it makes it easier to edit. You can't really get around changing the code or some form of it if the requirements change, you can just follow good coding principles by assigning values to variables to make them easier to edit, hence in your scenario when the values change you can just change it in one place rather than everywhere.
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional