Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can anyone explain me this part ?
Let vEpsilon = Pow(2,-37);
Load
Autonumber(SPID & '|' & FromDate & '|' & ToDate) as [SPID+Interval],
*;
LOAD
Date#(FromDate, 'YYYY-MM-DD') as FromDate,
Date(Date#(ToDate, 'YYYY-MM-DD') - $(#vEpsilon)) as ToDate,
Why we are using this Pow()?....Why we are subtracting this variable vEpsilon? What is the need?
Attachment for full coding
From what I understand, the script is doing a interval match on dates, but these dates might have looked like this
FromDate, ToDate
01/01/2018 02/01/2018
02/01/2018 03/01/2018
03/01/2018 04/01/2018
As you might see 02/01/2018 is found in both Row1 and Row2... in order to solve this problem, the script is subtracting a very very small number from 02/01/2018 in the first row.
Pow() is just a power function. So, 2 raise to the power of -37 is what we are subtracting from ToDate to make it slighly less than 02/01/2018... may be like 01/31/2018 23:59:59 and some micro seconds....