Hi there!
I have a use case where I want to find out the week number of the year. To do that I am using the following formula using built-in JS functions from ACC: Ceil((WeekDay(GetDate())+1 + DayOfYear(GetDate())) / 7)
However! It seems that when dividing a number that would lead to a decimal number like: 21,58 - This does not work, since ACC always returns 21,00 no matter the subsequent digits.
So that of course gives me the wrong result from the formula.
Any chance someone knows why this happens, and how to fix that??
See images for reference.
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @SorenDP ,
it's because SQL performs integer division.
you have to ''trick'' sql into thinking that on your division ther is at least one float.
Try this : ToDouble(151)/7
or this with your formula : Ceil(ToDouble((WeekDay(GetDate())+1 + DayOfYear(GetDate()))) / 7)
results :
Br,
Hello @SorenDP ,
it's because SQL performs integer division.
you have to ''trick'' sql into thinking that on your division ther is at least one float.
Try this : ToDouble(151)/7
or this with your formula : Ceil(ToDouble((WeekDay(GetDate())+1 + DayOfYear(GetDate()))) / 7)
results :
Br,
Works like a charm, thanks a lot!