Working days only in date calculation

Hello, Does anyone here know if there is a standard Navision function to calculate a date, using only days marked as workdays in the base calendar? So for instance I’d send a date in there, and a date expression (or a number of days, say 4 days), and the date that it returns would be 4 workdays from the date that I send in, basically excluding weekend days and holidays as marked in the base calendar. So assuming that only weekends are not workdays, I want to calculate 4 days from a Friday, it will return the Thursday after that. I can write a function like this myself, but I am pretty sure it’s already in there. I just haven’t been able to find it yet. Thanks

Hi Daniel, That would be CalcDateBOC in Codeunit 7600 Calendar Management. [edit] I bet you already went crazy looking in Codeunit 99000755 CalendarManagement… who named these codeunits anyway?!? [xx(][:p] A Space… the final frontier…

Thanks Nelson, I’ll try that function, I’m curious to see if it also works with date expressions other than days. You’re right, who names these things… and what does BOC mean anyway…

It works with any DateFormula. I had no experience with this codeunit but I saw your question, found it and tried it out a little. It’s nice. Post back with your own findings. Good luck!

well this is exactly what I needed. you pass it a source type and code, a date and a date expression (among other things) and it will first calculate the number of days in the date expression, and it will then calculate an end date using that number of working days. So if you pass it ‘1M’ and in that month there are 4 weekends, it will actually return 8 more working days more than 1M. The only thing is that it has a second source as a parameter, and a boolean ‘CheckBothCalendars’, but this does not return what I expected. I though if I send it a location code as a first source and company as the second source, that it would first check the location’s base calendar, and if it doesn’t find one then it would use the company’s base calendar, but it does not do that. Other than that, thjis is a pretty nifty little function :).

Now if we only knew what BOC is… “base o… calendar” perhaps?

A wild guess: BOth Calendars?

hummm, what if it is “Bastard Operator Calendar”, inspired on the BOFH chronicles? [:D][:D] http://bofh.ntk.net/Bastard.html http://www.theregister.co.uk/content/30/index.html A bible for any self-respecting IT guy… [:p]

[xx(][xx(] Nelson, Those links will deprive me of several hours of sleep…

The Register just updated their site. The new link is: http://www.theregister.com/odds/bofh/ Hey SV, wake up! There’s still a lot more reading to do! [:p]

quote:


Originally posted by nelson
The Register just updated their site. The new link is: http://www.theregister.com/odds/bofh/


Holy cow! Who created that web page, with a red-white striped background!? [xx(] Hm, maybe they did that on purpose - only a true BOFH would know the trick to make the text more readable [:D]