Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Workdate + 30D

Posted on by Microsoft Employee

In this condition I only want it to enter the BEGIN if the Date field 'Coshh Review Date' is greater than or equal to the WORKDATE + 30Days (Month). This is what I tried but it appears to be allowing dates over the 30 days. Any help will be appreciated!

IF recItem."Coshh Review Date" >= CALCDATE('<-' + recJobQueueEntry."Parameter Value 1" + 'D>', WORKDATE)  THEN BEGIN

*This post is locked for comments

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Workdate + 30D

    Please let us know if your problem is still not solved.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Workdate + 30D

    IF recItem."Coshh Review Date" >= CALCDATE('<' + recJobQueueEntry."Parameter Value 1" + 'D>', WORKDATE)  THEN BEGIN  should work

    Or to avoid your confusion store the value of the expression CALCDATE('<' + recJobQueueEntry."Parameter Value 1" + 'D>', WORKDATE) in a date variable first  before the comparison and compare that with review date. Try Message Box to output the value of the date variable and use your IF statement accordingly.

  • Suggested answer
    Yogesh Kulkarni_ Profile Picture
    Yogesh Kulkarni_ 1,762 on at
    RE: Workdate + 30D

    If you need 30 as fix, as suggested previously you can use:

    CALCDATE('<30D>',WORKDATE)

    Or if you need that to be parameterised then you can use:

    CALCDATE('<' + FORMAT((DateVariable))  + 'D>', WORKDATE)

    -Yogesh Kulkarni

    Please verify, if you find answer helpful.

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Workdate + 30D

    then use

    IF recItem."Coshh Review Date" <= CALCDATE('<' + recJobQueueEntry."Parameter Value 1" + 'D>', WORKDATE)  THEN BEGIN

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Workdate + 30D

    I want it so calculate if the date field is within 30 days of the workdate, so for example if the date field was set to 03/02/2017 or any date inbetween that and the workdate it will be accepted.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Workdate + 30D

    do you want to calculate (WORKDATE + 30D) or (WORKDATE-30D)?

    I understood it as -30D.

  • Suggested answer
    Yogesh Kulkarni_ Profile Picture
    Yogesh Kulkarni_ 1,762 on at
    RE: Workdate + 30D

    Use IF (recItem."Coshh Review Date" >= CALCDATE('<' + FORMAT((-1* intDate))  + 'D>', WORKDATE) ) THEN BEGIN

    FORMAT will convert your Integer value to Text and you can concatenate that.

    -Yogesh Kulkarni

    Please verify, if you find answer helpful.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Workdate + 30D

    thanks for the help!

    I've set a date to 23/03/2017  which shouldn't be accepted but it still is.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Workdate + 30D

    Use FORMAT((-1* intDate))

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Workdate + 30D

    I'm unable to change it however I tried another solution,

     IF recItem.FINDSET(FALSE, FALSE) THEN REPEAT

       EVALUATE(intDate,recJobQueueEntry."Parameter Value 1");

       IF (recItem."Coshh Review Date" >= CALCDATE('<' + (-1* intDate)  + 'D>', WORKDATE) ) THEN BEGIN

    This however errors  before the + and says "Type Conversion is not possible... Text + Integer

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans