web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Compare two dates from table Dynamics

(0) ShareShare
ReportReport
Posted on by

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)
  • Verified answer
    Zaid Tariq Profile Picture
    2,274 on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans