Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Match time interval?

    Hi guys,

I have this situation and i don't know exactly which formula should i use, I have tried to use "IntervalMatch" but with no success.

For the below i want to identify only the "OrderId" where "Date_WS" is between the interval "From" and "To". For the below example the id 2178515 should not appear since "Date_ws" is not between the mentioned interval. I have to take in consideration the hour interval as well.

OrderIdFromToDate_WS
19647162017-01-03 01:00:00.00002017-02-02 23:00:00.00002017-02-02 10:04:44.444444
19841482017-01-03 01:00:00.00002017-02-02 23:00:00.00002017-01-05 13:16:18.16181618
21785152017-01-03 01:00:00.00002017-02-02 23:00:00.00002017-02-01 14:12:57.12571257
21785152017-01-03 01:00:00.00002017-01-03 23:00:00.00002016-11-22 10:41:51.41514151
2 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi Vlad,

as you have all the values within the same table, IntervalMatch might be overkill for this.

If you do this in your load script, you can use the formula

if (From <= Date_WS and Date_WS <= To, 1, 0) - to generate a flag

or just use From <= Date_WS and Date_WS <= To in a WHERE clause to limit your data load

Marcus

ahaahaaha
Partner - Master
Partner - Master

Hi Vlad,

If in a script, then as an variant

LOAD*Inline

[OrderId, From, To, Date_WS

1964716, 2017-01-03 01:00:00.0000, 2017-02-02 23:00:00.0000, 2017-02-02 10:04:44.444444

1984148, 2017-01-03 01:00:00.0000, 2017-02-02 23:00:00.0000, 2017-01-05 13:16:18.16181618

2178515, 2017-01-03 01:00:00.0000, 2017-02-02 23:00:00.00000, 2017-02-01 14:12:57.12571257

2178515, 2017-01-03 01:00:00.0000, 2017-02-02 23:00:00.0000, 2016-11-22 10:41:51.41514151]

Where Date_WS>=From And Date_WS<=To;

Result

1.jpg

Regards,

Andrey