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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

prevent date overlapping

(0) ShareShare
ReportReport
Posted on by 5,125

we are working in some customization and a question had been raised to me  that , is the validstate fields (ValidFrom-ValidTo ) allow date overlapping

Ex:- suppose that i have  a shift table and i wanna the worker to have valid from to valid shift

like

worker  shiftcode ValidFrom   ValidTo

0001     sh0001    1/4/2013     1/5/2013

what will happen if some assign another shift in different dates but in the same month

like

worker  shiftcode ValidFrom   ValidTo

0001     sh0002    15/4/2013     15/5/2013

how to prevent date overlapping  like the above example ?????

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Deepak Agarwal Profile Picture
    8,585 on at
    RE: prevent date overlapping

    Hey Faress,

    Try below code,

    1. At the modified method of "ValidateFrom" field, check that "validatefrom" value should be greater than the value of "ValidTo" field (for this particular Worker) value.

    2. At the modified method of ValidateTo field write code to validate the ValidTo value should be greater than ValidFrom value.

    I hope this will help you..

    Harry

  • Suggested answer
    Florian Hopfner Profile Picture
    2,455 on at
    RE: prevent date overlapping

    Use a valid time state table.

  • mostafa mahmoud Profile Picture
    5,125 on at
    RE: prevent date overlapping

    i am using it already but i wanna to make sure that there is no overlapping issues

  • mostafa mahmoud Profile Picture
    5,125 on at
    RE: prevent date overlapping

    thanks FH-INWAY,

    i wanna just to make sure that every thing is ok

  • Verified answer
    Florian Hopfner Profile Picture
    2,455 on at
    RE: prevent date overlapping

    As far as I know there are no issues with overlapping in the framework for valid time state tables. The framework was specifically designed to prevent overlapping:

    "The system guarantees that the values in these date or date-time fields remain valid by automatically preventing overlap among date ranges. "

  • mostafa mahmoud Profile Picture
    5,125 on at
    RE: prevent date overlapping

    What About time

    like if i had shift table like the below table 

    shift code Time in  Time out
    0001 1.00 PM 8.00 PM
    0002 8.00 PM 4.00 AM

    i want to prevent overlaping in Time values not in DateTime values like the below table 

    shift code Time in  Time out
    0001 1.00 PM 8.00 PM
    0002 5.00 PM 7.00 PM
  • Florian Hopfner Profile Picture
    2,455 on at
    RE: prevent date overlapping

    The valid time state table framework does not support time only fields, only date or datetime fields. So in this case you would have to write your own validation similar to what Agarwal AX described.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans