Adding dates that are not overlapping
Application Type
Reactive
Service Studio Version
11.14.8 (Build 58515)

Hello to everyone,

I am very new to outsystems as well as programming. Going through some examples available in this platform, I developed some keen interest in this area and decided to move forward. . 

For me to understand the basics and concepts, I developed simple application to capture leave records. Unfortunately, I am not able to  prevent adding dates that are overlapping.

If I apply leave for 01/04/2022  to 05/04/2022 it creates a leave record accordingly.  But, if I create a leave record for 02/04/2022 also it created another leave record which overlaps the dates in the first record which I do not want to happen. 

This issue was discussed and solved in this forum. But due to my very poor knowledge in SQL/ aggregate, I am unable to figure out how to apply the suggested solution. 

As explained in this forum, I generated the OML file for this module and attached here. 

Can someone look at it and assist to prevent adding dates that are overlapping. 

Thanks a lot.  

LeaveApplication.oml

Kindly find updated version with message to user to inform this leave overlapping with existing one.

I already tested application on my side and working fine

LeaveApplicationModified.oml

Hi Lalith,

You need to check first any record exists into table has same dates or overlapping with users dates before create new record if yes you can stop saving and show error message or you can update existing record as per your business need.

if no so you can create new record.


Kindly find attached application after adding one more step into server action "LeaveCreateOrUpdate"

LeaveApplicationModified.oml

Hi Mostfa, 

Thanks for the quick response and appreciate it. I tried the application which you modified. But it still allows me to add leave records with overlaps. 

Did you test this at your end or am I doing something incorrect. 

Ideally with this validation, is there a way to inform User with appropriate message saying that there is a overlap in dates.

(Hope I am not asking too much. I struggled for months to settle this and finally decided get some help from this forum.)

Thanks a lot once again. 

Kindly find updated version with message to user to inform this leave overlapping with existing one.

I already tested application on my side and working fine

LeaveApplicationModified.oml

Hi Lalith,

If you able to solve this issue please mark my answer as solution. And if you need any help please let me know.

Hi Mostafa, 

Thank you so much for your assistance. It is working now.

After so much struggle, I was about to give up this. Luckily, you helped me .   

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.