Add date range constraint for the same person

0
I have 2 entities: Person and Training If a person say john has training scheduled from 16th August ,10:00 am to 16th August 12: pm. Training for john cannot be scheduled again for the same date and time range. Name String (Person) Training Begin Date (training) Training End Date(Training) For any other person, the training can be scheduled for the same or ay other date range. So basically when we click on add button after entering name and the dates, it opens a microflow which saves the data and adds it row. So now in that microflow a constraint also needs to be added upon saving the row, that if same person has training scheduled between same date range, it shouldn't overlap. It can be either before or after that date range.   Could you please provide any suggestions/examples as to how this can be achieved?
asked
2 answers
0

Hi Pragya,

You can add condition element in microflow where you can compare both your validations using And operator.

ex. enteredName!=Entity.Name And selectedDate!=entity.date

try to take use of true conditions before committing data.

Hope this will help you to start your logic.

Thank you.

answered
0

Hi Pragya,

Are your entities associated or independent from one another?

Assuming your entities is independent (and the other training events is not already in memory), I would recommend a database retrieve consisting of the following:

[NameString = ‘John’]
[TrainingBeginDate < NewTrainingEndDate]
[TrainingEndDate > NewTrainingStartDate]

You can retrieve only the first one, as this should pick up your conflict training event.

answered