cloudstrifer
Technical User
Hi,
My following formula does not work and I don't have a clue why. I try to create a datevar array with values coming from sql expressions. Please help
DateVar Array holidays := [date({%CANADA DAY}), date({%CHRISTMAS DAY}), date({%CIVIC HOLIDAY}), date({%GOOD FRIDAY}), date({%LABOUR DAY}), date({%NEW YEARS DAY}), date({%THANKSGIVING}), date({%victoria day}) ];
//check for weekend and if next business day is a holiday
if dayofweek({@delivery matrix}) = 1 and {@delivery matrix} + 1 in holidays then {@delivery matrix} + 2
else if dayofweek({@delivery matrix}) = 7 and {@delivery matrix} + 2 in holidays then {@delivery matrix} + 3
// check for holidys only
else if {@delivery matrix} in holidays then {@delivery matrix} + 1
// if sunday then add 1 day
else if dayofweek({@delivery matrix}) = 1 then {@delivery matrix} + 1
// if saturday then add 2 days
else if dayofweek({@delivery matrix}) = 7 then {@delivery matrix} + 2
else {@delivery matrix}
My following formula does not work and I don't have a clue why. I try to create a datevar array with values coming from sql expressions. Please help
DateVar Array holidays := [date({%CANADA DAY}), date({%CHRISTMAS DAY}), date({%CIVIC HOLIDAY}), date({%GOOD FRIDAY}), date({%LABOUR DAY}), date({%NEW YEARS DAY}), date({%THANKSGIVING}), date({%victoria day}) ];
//check for weekend and if next business day is a holiday
if dayofweek({@delivery matrix}) = 1 and {@delivery matrix} + 1 in holidays then {@delivery matrix} + 2
else if dayofweek({@delivery matrix}) = 7 and {@delivery matrix} + 2 in holidays then {@delivery matrix} + 3
// check for holidys only
else if {@delivery matrix} in holidays then {@delivery matrix} + 1
// if sunday then add 1 day
else if dayofweek({@delivery matrix}) = 1 then {@delivery matrix} + 1
// if saturday then add 2 days
else if dayofweek({@delivery matrix}) = 7 then {@delivery matrix} + 2
else {@delivery matrix}