Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Convert value integer to DateFormula

Posted on by 265

Imagine this scenario,

I've calculated the average number of days that a Purchase Order takes to get in the wharehouse. Basically the difference between the Posting Date and the Order Date . The result was a value integer.

My goal is to fill in the table Item , the field Safety Lead Time that is a date formula, but it need a preefix such as D or it gives me back error.
How can i converto the integer to days?

This is what i've tried

...

MediaDias:=ROUND((DiasTotal/ContadorDocs),1,'>');
EVALUATE(DataP,FORMAT(MEdiaDias));

Item."Safety Lead Time Calculado":=DataP;
Item.MODIFY;

Where DataP is also datatype Dateformula.

Thanks for the help

*This post is locked for comments

  • Suggested answer
    Rikarddo Profile Picture
    Rikarddo 265 on at
    RE: Convert value integer to DateFormula

    Thanks! It was a big help!

  • Suggested answer
    Rikarddo Profile Picture
    Rikarddo 265 on at
    RE: Convert value integer to DateFormula

    Got it..

    EVALUATE(Item."Safety Lead Time Calculado", FORMAT(MEdiaDias) + 'D');

    Item.MODIFY;

    Thanks anyway!

  • Verified answer
    Hannes Holst Profile Picture
    Hannes Holst 5,767 on at
    RE: Convert value integer to DateFormula
    MediaDias:=ROUND((DiasTotal/ContadorDocs),1,'>');
    EVALUATE(DataP,'<'+FORMAT(MEdiaDias)+'D>');

    There are probably better solutions somewhere :-)

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans