Skip to main content
manavik105
November 6, 2023
Question

Caladddays function is not calculating for next year and retrogressing back to same year

  • November 6, 2023
  • 7 replies
  • 0 views

Hi All,

I have a scenario where if an expected SLA date&time falls on a non-working day, I need to get next working day value.

For example, I have my initial submitted date as 12/27/2023 2:01 PM PST and expected SLA date time based on some biz logic should be 1/2/2024 7:01 AM PST. I have used the below logic but somehow instead of getting the SLA date result for next year as 1/2/2024 7:01 AM PST, I am getting the SLA date result in the same year as 1/2/2023 7:01 AM PST.
Please note correct process calendars are used and Dec 30 2023,  Dec 31 2023 and Jan 1 2024 are all set as non-working day.

Please help/advise on how I can update to get the correct value:

local!finalSLADateTime:
if(
calisworkday(1/1/2024 7:01 AM PST, local! Calendar),
1/1/2024 7:01 AM PST,
1/1/2024 7:01 AM PST + (dayofyear(caladddays(1/1/2024 7:01 AM PST, 0, local! Calendar)) - dayofyear(1/1/2024 7:01 AM PST))
),

7 replies

annap0005
November 7, 2023

This may help you,

a!localVariables(
local!date:todatetime("12/28/2023"),
local!sla:2,
workday(local!date,local!sla,cons!LA_Holidays)
)

keep holidays in constant.

manavik105
November 7, 2023

Thank you for the response Anna. Do you mean not to use a process Calendar and use just a constant with holidays instead?

annap0005
November 8, 2023

Yes. Do that and use the code which I paste and test