
I'm having problem with my little task. I have a table with information about two users who are working during this time.image If this time intersect I need get a MESSAGE/ERROR about it. Can you explain how to do this? Thanks!!
*This post is locked for comments
I have the same question (0)Hi,
If you want to use show the message when user enters the data in the field Finish Date then go to the OnValidate trigger of the Finish Date and write the following code:
Test.SETCURRENTKEY("Date Start","Date Finish");
Test.SETFILTER(Name,Name);
Test.SETFILTER(ID,'<>%1',ID);
IF Test.FINDFIRST THEN
BEGIN
IF (Test."Date Start" >= "Date Start") AND (Test."Date Start" <= "Date Finish") THEN
ERROR('User %1 is already busy during these days',Test.Name)
ELSE IF (Test."Date Finish" >= "Date Start") AND (Test."Date Finish" <= "Date Finish") THEN
ERROR('User %1 is already busy during these days ',Test.Name)
ELSE IF (Test."Date Start" <= "Date Start") AND (Test."Date Finish" >= "Date Finish") THEN
ERROR('User %1 is already busy during these days ',Test.Name);
END;
Create a Test Record variable of type Test table