Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can any one explain the following code?
InYearToDate(TempDate, $(varMaxDate),0)*-1 as YTD
Why do they multiply with -1?
I would appreciate any help.
Thanks!
InYearToDate returns true if date lies inside the part of year containing basedate up until and including the last millisecond of basedate.
True = -1.
So multiplying it by -1 would make -1 * -1 = 1.
They're probably counting how many dates are in that date and they want to sum 1's instead of summing -1's so that you get a possitive result.
Thank you very much Daniel.
This makes sense. I thought true would give 1 and so I was wondering why do they multiply by -1.
Does it return 0 if false?
Thanks again
Yes
-1 = True
0 = False
That's true in almost every computing language.
Thanks a lot Daniel.
Have a good one.